Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: 팔로워 팔로잉 페이지 디자인 수정 및 확인 기능 추가 #288

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import { ReactNode } from 'react';
import Modal from '@/components/Modal/Modal';
import useBooleanOutput from '@/hooks/useBooleanOutput';
import * as styles from './ModalButtonStyle.css';
import DeleteButton from '/public/icons/trash_can.svg';
import { modalLocale } from '@/app/list/[listId]/locale';
import { useLanguage } from '@/store/useLanguage';
import DeleteModal from '@/components/DeleteModal/DeleteModal';

interface DeleteModalProps {
children?: ReactNode;
interface DeleteModalButtonProps {
onDelete: () => void;
}

export default function DeleteModal({ children, onDelete }: DeleteModalProps) {
export default function DeleteModalButton({ onDelete }: DeleteModalButtonProps) {
const { language } = useLanguage();
const { isOn, handleSetOff, handleSetOn } = useBooleanOutput(); //모달 열림,닫힘 상태 관리
const handleConfirmButtonClick = () => {
Expand All @@ -28,13 +26,7 @@ export default function DeleteModal({ children, onDelete }: DeleteModalProps) {

{/*✨ 조합한 모달 */}
{isOn && (
<Modal handleModalClose={handleSetOff}>
<Modal.Title>{modalLocale[language].deleteMessage}</Modal.Title>
{children}
<Modal.Button onCancel={handleSetOff} onClick={handleConfirmButtonClick}>
{modalLocale[language].confirm}
</Modal.Button>
</Modal>
<DeleteModal handleClose={handleSetOff} handleDelete={handleConfirmButtonClick} handleCancel={handleSetOff} />
)}
</>
);
Expand Down
25 changes: 0 additions & 25 deletions src/app/user/[userId]/(follow)/_components/Header.css.ts

This file was deleted.

20 changes: 0 additions & 20 deletions src/app/user/[userId]/(follow)/_components/Header.tsx

This file was deleted.

46 changes: 21 additions & 25 deletions src/app/user/[userId]/(follow)/_components/UserList.css.ts
Original file line number Diff line number Diff line change
@@ -1,53 +1,49 @@
import { style } from '@vanilla-extract/css';
import * as fonts from '@/styles/__font.css';
import { vars } from '@/styles/__theme.css';

export const container = style({
width: '100%',
padding: '0 18px',
import * as fonts from '@/styles/font.css';
import { vars } from '@/styles/theme.css';

display: 'flex',
flexDirection: 'column',
rowGap: '12px',
});

export const profileContainer = style({
export const item = style({
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
});

export const wrapper = style({
export const profile = style({
display: 'flex',
alignItems: 'center',
columnGap: '12px',

fontSize: '1.6rem',
fontWeight: '600',

cursor: 'pointer',
});

export const nickname = style([fonts.BodyBold]);

export const button = style([
fonts.caption,
fonts.LabelBold,
{
height: '24px',
padding: '8px 12px',
padding: '0.6rem 1.2rem',

display: 'flex',
justifyContent: 'center',
alignItems: 'center',
color: vars.color.bluegray10,

fontSize: '1.6rem',
color: vars.color.blue,
backgroundColor: '#EBF4FF',

borderRadius: '50px',
borderRadius: '1.5rem',
},
]);

export const emptyMessage = style({
marginTop: '69px',
export const container = style({
width: 'auto',
margin: '8px 16px',
padding: '12px 12px',
borderRadius: '2rem',

fontSize: '1.6rem',
display: 'flex',
flexDirection: 'column',
rowGap: '16px',

textAlign: 'center',
backgroundColor: vars.color.white,
});
61 changes: 27 additions & 34 deletions src/app/user/[userId]/(follow)/_components/UserList.tsx
Original file line number Diff line number Diff line change
@@ -1,38 +1,26 @@
'use client';

import { ReactNode } from 'react';
import { useParams, useRouter } from 'next/navigation';
import { useMutation, useQueryClient } from '@tanstack/react-query';

import UserProfileImage from '@/components/UserProfileImage/UserProfileImage';
import deleteFollower from '@/app/_api/follow/deleteFollower';
import { userLocale } from '@/app/user/locale';
import { useUser } from '@/store/useUser';
import { useLanguage } from '@/store/useLanguage';
import { UserProfileType } from '@/lib/types/userProfileType';
import { QUERY_KEYS } from '@/lib/constants/queryKeys';

import * as styles from './UserList.css';
import useBooleanOutput from '@/hooks/useBooleanOutput';
import DeleteModal from '@/components/DeleteModal/DeleteModal';
import UserProfileImage from '@/components/UserProfileImage/UserProfileImage';
import NoDataComponent from '@/components/NoData/NoDataComponent';
import getFollowerList from '@/app/_api/follow/getFollowerList';
import { userLocale } from '@/app/user/locale';
import { useLanguage } from '@/store/useLanguage';

// const BUTTON_MESSAGE = {
// ko: {
// delete: '삭제',
// },
// };
//
// const EMPTY_MESSAGE = {
// ko: {
// follower: '아직은 팔로워가 없어요',
// following: '아직 팔로우한 사람이 없어요',
// },
// };
import * as styles from './UserList.css';

function DeleteFollowerButton({ userId }: { userId: number }) {
const { language } = useLanguage();
const { user } = useUser();
const queryClient = useQueryClient();
const { handleSetOff, handleSetOn, isOn } = useBooleanOutput();

const deleteUser = useMutation({
mutationKey: [QUERY_KEYS.deleteFollower, userId],
Expand All @@ -45,14 +33,14 @@ function DeleteFollowerButton({ userId }: { userId: number }) {
});

return (
<button
className={styles.button}
onClick={() => {
deleteUser.mutate();
}}
>
{userLocale[language].delete}
</button>
<>
<button className={styles.button} onClick={handleSetOn}>
{userLocale[language].delete}
</button>
{isOn && (
<DeleteModal handleClose={handleSetOff} handleCancel={handleSetOff} handleDelete={() => deleteUser.mutate()} />
)}
</>
);
}

Expand All @@ -62,19 +50,19 @@ interface UserProps {
isOwner?: boolean;
}

function User({ user, button, isOwner }: UserProps) {
function UserItem({ user, button, isOwner }: UserProps) {
const router = useRouter();

return (
<div className={styles.profileContainer}>
<div className={styles.item}>
<div
className={styles.wrapper}
className={styles.profile}
onClick={() => {
router.push(`/user/${user.id}/mylist`);
}}
>
<UserProfileImage src={user.profileImageUrl} size={50} />
{user.nickname}
<UserProfileImage src={user.profileImageUrl} size={40} />
<span className={styles.nickname}>{user.nickname}</span>
</div>
{isOwner ? button : null}
</div>
Expand All @@ -98,10 +86,15 @@ function UserList({ type, list }: UserListProps) {
<NoDataComponent message={userLocale[language].empty[type]} />
) : (
<>
{type === 'following' && list?.map((user: UserProfileType) => <User key={user.id} user={user} />)}
{type === 'following' && list?.map((user: UserProfileType) => <UserItem key={user.id} user={user} />)}
{type === 'follower' &&
list?.map((user: UserProfileType) => (
<User key={user.id} user={user} button={<DeleteFollowerButton userId={user.id} />} isOwner={isOwner} />
<UserItem
key={user.id}
user={user}
button={<DeleteFollowerButton userId={user.id} />}
isOwner={isOwner}
/>
))}
</>
)}
Expand Down
Loading
Loading