Skip to content

Commit

Permalink
Feat: display intensity in post card
Browse files Browse the repository at this point in the history
  • Loading branch information
hookor authored and cuconveniencestore committed Aug 29, 2024
1 parent 47849f1 commit 2af47c1
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 12 deletions.
14 changes: 13 additions & 1 deletion src/components/posts/following/PostBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,28 @@ const PostBody = ({
shot,
menu,
brand,
intensity,
size,

onClick
}: Pick<
FollowingPost,
'postTitle' | 'photo' | 'caffeine' | 'shot' | 'menu' | 'brand'
| 'postTitle'
| 'photo'
| 'caffeine'
| 'shot'
| 'menu'
| 'brand'
| 'intensity'
| 'size'
> & { onClick: () => void }) => {
const CafeDetailProps = {
brand,
caffeine,
shot,
menu,
intensity,
size,
className: PaddingT12,
posts: true,
onClick
Expand Down
23 changes: 21 additions & 2 deletions src/components/posts/following/PostCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { useNavigateTo } from '@/hooks/useNavigateTo';
import PostBody from '@/components/posts/following/PostBody';
import { useVerifyOwner } from '@/hooks/post/useVerifyOwner';
import React, { Suspense } from 'react';
import { Divider } from '@/styles/styles';

const PublicOption = React.lazy(
() => import('../../post/overlay/PublicOption')
Expand All @@ -38,9 +39,20 @@ const PostCard = ({ ...props }: FollowingPost) => {
caffeine,
shot,
menu,
brand
brand,
intensity,
size
} = props;
const PostBodyProps = { postTitle, photo, caffeine, shot, menu, brand };
const PostBodyProps = {
postTitle,
photo,
caffeine,
shot,
menu,
brand,
intensity,
size
};
const MiniProfileProps = { url: profileUrl, nickname, caffeine: sum, userId };

const { postOwner } = useVerifyOwner(postId);
Expand Down Expand Up @@ -109,6 +121,8 @@ const PostCard = ({ ...props }: FollowingPost) => {
onClick={handleToPost}
/>

<CardDivider className={Divider} />

<div>
{socialCounts && (
<PostSocial
Expand Down Expand Up @@ -137,4 +151,9 @@ const UserProfile = styled.div`
padding-bottom: 12px;
`;

const CardDivider = styled.div`
padding-top: 16px;
margin: 0 16px;
`;

export default PostCard;
14 changes: 6 additions & 8 deletions src/types/types.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import {
TouchEventHandler,
RefObject,
ChangeEvent,
MouseEventHandler
} from 'react';
import { RefObject, ChangeEvent, MouseEventHandler } from 'react';

export interface LazyRouteType {
index: boolean;
Expand Down Expand Up @@ -179,6 +174,7 @@ export interface CommentType {
reply_count: number;
postNum: string;
id: number;
public_id: string;
}

export interface CommentPrototype
Expand All @@ -189,7 +185,7 @@ export interface CommentPrototype
}
export type Reply = Pick<
CommentType,
'profileUrl' | 'nickname' | 'content' | 'created_at' | 'id'
'profileUrl' | 'nickname' | 'content' | 'created_at' | 'id' | 'public_id'
>;

export interface FollowingPost extends SimplifyUser {
Expand All @@ -204,6 +200,8 @@ export interface FollowingPost extends SimplifyUser {
menu: string;
brand: string;
userId: string;
intensity: string;
size: number;
}

export interface Fetched {
Expand Down Expand Up @@ -254,7 +252,7 @@ export interface CafeDetailTypes {
shot?: string | number;
posts?: boolean;
intensity: string;
size: string;
size: number;
onClick?: () => void;
}

Expand Down
4 changes: 3 additions & 1 deletion src/utils/manageProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export const generatePostCardProps = (
shot: post.shot,
menu: post.menu,
brand: selected ? selected : post.brand,
userId: post.userId
userId: post.userId,
intensity: post.intensity,
size: post.size
};
};

0 comments on commit 2af47c1

Please sign in to comment.