Skip to content

Commit

Permalink
Feat: display intensity in cafe detail
Browse files Browse the repository at this point in the history
  • Loading branch information
hookor authored and cuconveniencestore committed Aug 29, 2024
1 parent 2e6f950 commit 20c73ec
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
8 changes: 6 additions & 2 deletions src/components/post/CafeDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@ const CafeDetail = ({
menu,
shot,
posts = false,
onClick
onClick,
intensity,
size
}: CafeDetailTypes) => {
const CafeDetailProps = {
brand,
caffeine,
menu,
shot,
posts,
onClick
onClick,
intensity,
size
};
return (
<div className={cx(Column, className)}>
Expand Down
13 changes: 9 additions & 4 deletions src/components/post/CafeDetailContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,13 @@ const CafeDetailContent = ({
onClick,
menu,
caffeine,
shot
shot,
intensity,
size
}: CafeDetailContent) => {
const mild = intensity === '연하게';
const base = intensity === '기본' && shot === 0;

return (
<>
<div className={posts ? cx(PostsCafe, Align) : Cafe}>
Expand All @@ -38,9 +43,9 @@ const CafeDetailContent = ({
<div
className={CaffeineDetail}
onClick={onClick}>
{`${menu} ${shot !== '0' ? `(+${shot}` : ''}${
shot !== '0' ? '샷)' : ''
}`}
{mild && `${menu} (${intensity}, ${size})`}
{!mild && !base && `${menu} (+${shot}샷, ${size})`}
{!mild && base && `${menu} (${intensity}, ${size})`}
<br />
{!mini && including}
<span className={ColorMain}>
Expand Down
8 changes: 7 additions & 1 deletion src/components/post/CaffeineInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ const CaffeineInfo = ({
brand,
menu,
caffeine,
shot
shot,
intensity,
size
}: {
brand: string;
menu: string;
caffeine: number;
shot: number;
intensity: string;
size: string;
}) => {
return (
<Container className={cx(Flex, Align)}>
Expand All @@ -25,6 +29,8 @@ const CaffeineInfo = ({
caffeine={caffeine}
menu={menu}
shot={shot}
intensity={intensity}
size={size}
/>
</Container>
);
Expand Down
2 changes: 2 additions & 0 deletions src/components/post/PostDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ const PostDetail = ({ postNum }: { postNum: string }) => {
menu={postData.data.menu}
caffeine={postData.data.caffeine}
shot={postData.data.shot}
intensity={postData.data.intensity}
size={postData.data.size}
/>
<PostedAt at={timestampToDate(postData.data.created_at)} />
<div className={Divider} />
Expand Down
2 changes: 2 additions & 0 deletions src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ export interface CafeDetailTypes {
menu?: string;
shot?: string | number;
posts?: boolean;
intensity: string;
size: string;
onClick?: () => void;
}

Expand Down

0 comments on commit 20c73ec

Please sign in to comment.