From fb4d7782b209355424f53d5626c35f9d372242c8 Mon Sep 17 00:00:00 2001 From: brian <90752841+wokbjso@users.noreply.github.com> Date: Tue, 26 Nov 2024 15:10:42 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=B9=88=20=EC=86=8C=EC=8B=9D=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=B9=9C=EA=B5=AC=20=EC=B6=94?= =?UTF-8?q?=EC=B2=9C=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../news/components/molecules/empty-news.tsx | 5 + .../news/components/organisms/news-list.tsx | 2 +- .../molecules/recommended-profile-card.tsx | 155 +++++++++++++----- .../recommended-profile-card-list.tsx | 39 +++-- .../profile/components/organisms/my-page.tsx | 2 +- 5 files changed, 149 insertions(+), 54 deletions(-) diff --git a/features/news/components/molecules/empty-news.tsx b/features/news/components/molecules/empty-news.tsx index 3aa8f675..4a5f9934 100644 --- a/features/news/components/molecules/empty-news.tsx +++ b/features/news/components/molecules/empty-news.tsx @@ -2,6 +2,7 @@ import Link from 'next/link'; import { SpeechBubbleIcon } from '@/components/atoms'; import { Divider } from '@/components/atoms/divider'; +import { RecommendedProfileCardList } from '@/features/profile-recommend'; import { css } from '@/styled-system/css'; import { flex } from '@/styled-system/patterns'; @@ -22,6 +23,10 @@ export const EmptyNews = () => { + ); }; diff --git a/features/news/components/organisms/news-list.tsx b/features/news/components/organisms/news-list.tsx index 27556114..6a031b39 100644 --- a/features/news/components/organisms/news-list.tsx +++ b/features/news/components/organisms/news-list.tsx @@ -30,7 +30,7 @@ export const NewsList = () => { // void queryClient.refetchQueries({ queryKey: ['newsData'], type: 'active' }); // }; - return !isEmpty ? ( + return isEmpty ? ( ) : ( <> diff --git a/features/profile-recommend/components/molecules/recommended-profile-card.tsx b/features/profile-recommend/components/molecules/recommended-profile-card.tsx index 44b49e57..775351c9 100644 --- a/features/profile-recommend/components/molecules/recommended-profile-card.tsx +++ b/features/profile-recommend/components/molecules/recommended-profile-card.tsx @@ -4,15 +4,17 @@ import { Button } from '@/components/atoms'; import { ProfileImage } from '@/components/molecules'; import { useProfileData } from '@/features/profile/hooks'; import { useMemberFollowingState } from '@/hooks'; -import { css } from '@/styled-system/css'; -import { flex } from '@/styled-system/patterns'; +import { css, cva } from '@/styled-system/css'; -interface ProfileCardProps { +import { ProfileCardListProps } from '../organisms'; + +interface ProfileCardProps extends Pick { isMyProfile: boolean; memberId: number; } export function RecommendedProfileCard({ + variant = 'vertical', isMyProfile, memberId, }: ProfileCardProps) { @@ -26,9 +28,12 @@ export function RecommendedProfileCard({ if (!profileData) return null; return ( -
- -
+
+ +
-

{profileData.nickname}

-

- {profileData.introduction ? profileData.introduction : null} -

+
+

{profileData.nickname}

+

+ {profileData.introduction ? profileData.introduction : null} +

+
-
+
{!isMyProfile && ( <> {isFollowing ? ( @@ -72,44 +79,110 @@ export function RecommendedProfileCard({ } const ProfileCardStyle = { - layout: flex({ - position: 'relative', - direction: 'column', - alignItems: 'center', - width: '146px', - height: '208px', - backgroundColor: 'fill.normal', - borderRadius: '10px', - shrink: 0, - p: '16px', + layout: cva({ + base: { + position: 'relative', + flexShrink: 0, + backgroundColor: 'fill.normal', + borderRadius: '10px', + p: '16px', + }, + variants: { + variant: { + vertical: { width: '146px', height: '208px' }, + horizontal: { display: 'flex', alignItems: 'center', height: '100px' }, + }, + }, }), - link: flex({ - position: 'relative', - direction: 'column', - alignItems: 'center', + link: cva({ + base: { + w: 'full', + display: 'flex', + position: 'relative', + }, + variants: { + variant: { + vertical: { + flexDirection: 'column', + alignItems: 'center', + }, + horizontal: { + alignItems: 'center', + }, + }, + }, }), - image: css({ - position: 'relative', - w: '60px', - h: '60px', - mb: '12px', + imageLayout: cva({ + base: { + position: 'relative', + w: '60px', + h: '60px', + }, + variants: { + variant: { + vertical: { + mb: '12px', + }, + horizontal: {}, + }, + }, }), nickname: css({ textStyle: 'body2.normal', fontWeight: 600, mb: '2px', }), - introduction: css({ - textStyle: 'label2', - fontWeight: 400, - color: 'text.alternative', - textAlign: 'center', - lineClamp: 2, + introduction: cva({ + base: { + textStyle: 'label2', + fontWeight: 400, + color: 'text.alternative', + lineClamp: 2, + }, + variants: { + variant: { + vertical: { + textAlign: 'center', + }, + horizontal: { wordBreak: 'keep-all' }, + }, + }, + }), + textLayout: cva({ + base: { + display: 'flex', + flexDirection: 'column', + }, + variants: { + variant: { + vertical: { + alignItems: 'center', + }, + horizontal: { + justifyContent: 'center', + ml: '12px', + w: '50%', + }, + }, + }, }), - followButton: css({ - w: 'full', - p: '0 20px', - position: 'absolute', - bottom: '16px', + followButton: cva({ + base: { + position: 'absolute', + }, + variants: { + variant: { + vertical: { + w: 'full', + p: '0 20px', + bottom: '16px', + left: '50%', + transform: 'translateX(-50%)', + }, + horizontal: { + right: '16px', + }, + }, + }, }), }; diff --git a/features/profile-recommend/components/organisms/recommended-profile-card-list.tsx b/features/profile-recommend/components/organisms/recommended-profile-card-list.tsx index 39599830..4f746b75 100644 --- a/features/profile-recommend/components/organisms/recommended-profile-card-list.tsx +++ b/features/profile-recommend/components/organisms/recommended-profile-card-list.tsx @@ -1,17 +1,22 @@ import { Suspense } from 'react'; import { useCurrentMemberInfo, useMemberFollowingState } from '@/hooks'; -import { css } from '@/styled-system/css'; -import { flex } from '@/styled-system/patterns'; +import { css, cva } from '@/styled-system/css'; import { recommendedMemberIds } from '../../constants'; import { RecommendedProfileCard } from '../molecules'; -interface ProfileCardListProps { +type VariantType = 'vertical' | 'horizontal'; + +export interface ProfileCardListProps { title: string; + variant?: VariantType; } -export function RecommendedProfileCardList({ title }: ProfileCardListProps) { +export function RecommendedProfileCardList({ + title, + variant = 'horizontal', +}: ProfileCardListProps) { const { data: myData } = useCurrentMemberInfo(); const { useSyncFollowingListState } = useMemberFollowingState(); useSyncFollowingListState(recommendedMemberIds); @@ -26,10 +31,11 @@ export function RecommendedProfileCardList({ title }: ProfileCardListProps) {

{title}

-
+
{recommendedMemberIds.map((memberId) => ( @@ -52,12 +58,23 @@ const ProfileCardListStyle = { fontWeight: 600, mb: '16px', }), - slider: flex({ - gap: '8px', - overflowX: 'auto', - mb: '16px', - '&::-webkit-scrollbar': { - display: 'none', + slider: cva({ + base: { + display: 'flex', + gap: '8px', + overflowX: 'auto', + mb: '16px', + '&::-webkit-scrollbar': { + display: 'none', + }, + }, + variants: { + variant: { + vertical: { + flexDirection: 'column', + }, + horizontal: {}, + }, }, }), }; diff --git a/features/profile/components/organisms/my-page.tsx b/features/profile/components/organisms/my-page.tsx index 20753559..7722386e 100644 --- a/features/profile/components/organisms/my-page.tsx +++ b/features/profile/components/organisms/my-page.tsx @@ -61,7 +61,7 @@ export function MyProfile({ />
- +