Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
a736e0a
feat: 모바일 마이페이지에서 사용하는 타입을 추가합니다.
WonJuneKim Mar 13, 2025
c7bcc8f
refactor: 버튼의 객체를 컴포넌트 외부에 선언합니다.
WonJuneKim Mar 13, 2025
6c7b9cd
refactor: 무한 스크롤 커스텀 훅에 option을 오버라이딩할 수 있도록 매개변수를 추가합니다.
WonJuneKim Mar 13, 2025
0dbcf7a
refactor: 커스텀 훅이 option을 오버라이딩 하고, 데이터 형태 그대로를 반환하도록 수정합니다.
WonJuneKim Mar 13, 2025
04679d4
feat: 모바일 마이페이지의 스타일을 추가합니다.
WonJuneKim Mar 13, 2025
7fb32b3
move: 불필요한 주석을 제거합니다.
WonJuneKim Mar 13, 2025
1a83cfd
feat: 모바일 밸런스게임 카드의 organisms을 구현합니다.
WonJuneKim Mar 13, 2025
5ffe6ff
feat: 스토리북에서 이미지를 테스트하기 위한 샘플 이미지를 추가합니다.
WonJuneKim Mar 13, 2025
3d2276e
docs: DateGroupedCard 컴포넌트의 스토리북을 추가합니다.
WonJuneKim Mar 13, 2025
f24481c
refactor: ContentsButton의 image props을 옵셔널로 수정합니다.
WonJuneKim Mar 13, 2025
e5c20fe
feat: 마이페이지 인터페이스에 imgUrl을 옵셔널로 추가 선언 후 정렬합니다.
WonJuneKim Mar 13, 2025
34cbd2f
feat: 모바일 마이페이지에 데이터 패칭을 수행하여 구현합니다.
WonJuneKim Mar 13, 2025
2350358
feat: LayoutNoFooter의 모바일 분기점을 설정합니다.
WonJuneKim Mar 13, 2025
8d35ec9
refactor: 마이페이지의 레이아웃 분기점을 재설정합니다.
WonJuneKim Mar 13, 2025
9349cc0
refactor: 마이페이지에서 사용하는 인터페이스를 api response에 맞게 재설정합니다.
WonJuneKim Mar 13, 2025
17d0b7a
feat: 모바일 마이페이지 레이아웃을 위한 추가 스타일을 생성합니다.
WonJuneKim Mar 13, 2025
5d58724
feat: 데이터가 렌더링 되는 부분에 gap을 추가합니다.
WonJuneKim Mar 13, 2025
90a1867
move: 불필요한 콘솔을 제거합니다.
WonJuneKim Mar 13, 2025
276ff20
move: 사용되지 않는 문구를 제거합니다.
WonJuneKim Mar 13, 2025
8c2a752
refactor: images 값이 존재하지 않거나, 두 값이 쌍으로 존재하지 않을 때 빈 배열을 반환합니다.
WonJuneKim Mar 13, 2025
779179a
move: 요구사항이 아닌 기본 값을 제거합니다.
WonJuneKim Mar 13, 2025
3bdeaa2
refactor: 북마크 아이콘 표기 상태를 activeButton의 state로 분기합니다.
WonJuneKim Mar 13, 2025
a4030a4
refactor: useEffect의 의존성 배열안에 activeButton 을 추가합니다.
WonJuneKim Mar 13, 2025
e973e44
refactor: MenuItem의 props 구조를 ReactNode를 이용해 확장합니다.
WonJuneKim Mar 13, 2025
08bbc3a
docs: 수정된 props를 스토리 파일에 반영합니다.
WonJuneKim Mar 13, 2025
793a3c5
refactor: 수정된 MenuTap 구조를 적용합니다.
WonJuneKim Mar 13, 2025
4a95bfe
design: label의 길이가 길어져도 길이가 확장되는 구조로 변경합니다.
WonJuneKim Mar 13, 2025
4ea14f7
feat: 마이페이지에 사용하는 svg 파일을 추가합니다.
WonJuneKim Mar 13, 2025
4d3afbc
refactor: 수정된 menuData의 데이터 타입에 맞춰 props를 변경합니다.
WonJuneKim Mar 13, 2025
3325618
feat: 회원정보 수정 메뉴와 스타일을 추가합니다.
WonJuneKim Mar 13, 2025
392ab1f
feat: menuData 이동 시 상수화된 경로를 사용합니다.
WonJuneKim Mar 13, 2025
e8f1eeb
feat: 모바일 톡픽 컴포넌트에 클릭 핸들러를 추가합니다.
WonJuneKim Mar 13, 2025
fa8819d
feat: 밸런스 게임 아이디 가공 시 onClick 요소를 추가합니다.
WonJuneKim Mar 13, 2025
dd9906f
feat: imgUrl이 존재하지 않을 때 랜덤 이미지가 출력 기능을 추가합니다.
WonJuneKim Mar 13, 2025
db250de
refactor: 컴포넌트의 최상우 태그를 Link로 변경합니다.
WonJuneKim Mar 13, 2025
ef1789c
docs: 컴포넌트의 태그 변경 사항에 맞춰 스토리북 항목을 추가합니다.
WonJuneKim Mar 13, 2025
72953d8
refactor: 하위 컴포넌트의 태그 변경 사항에 맞춰 이벤트 핸들러를 제거합니다.
WonJuneKim Mar 13, 2025
93520b2
refactor: 톡픽의 imgUrl이 존재하지 않는 경우 빈 값을 보냅니다.
WonJuneKim Mar 13, 2025
625a187
feat: 북마크 커스텀 훅을 모바일 마이페이지에 적용합니다.
WonJuneKim Mar 13, 2025
79a4469
design: observer의 스타일을 선언합니다.
WonJuneKim Mar 13, 2025
0023910
feat: UseEffect의 의존성 배열에 영향을 주는 값을 추가합니다.
WonJuneKim Mar 13, 2025
beb1098
refactor: 옵셔널 체이닝을 사용하여 조건문을 간결하게 수정합니다.
WonJuneKim Mar 13, 2025
a520bb2
refactor: 널 병합 연산자를 사용해 falsy한 값을 보장합니다.
WonJuneKim Mar 13, 2025
ef01709
refactor: imgUrl이 없을 땐 undefined로 명시적 반환을 합니다.
WonJuneKim Mar 13, 2025
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
31 changes: 18 additions & 13 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import TalkPickVotes from '@/pages/MyPage/TalkPick/TalkPickVotes';
import TalkPickComments from '@/pages/MyPage/TalkPick/TalkPickComments';
import BalanceGameWritten from '@/pages/MyPage/BalanceGame/BalanceGameWritten';
import BalanceGameEditPage from '@/pages/BalanceGameEditPage/BalanceGameEditPage';
import MyMobilePage from '@/pages/mobile/MyMobilePage/MyMobilePage';
import ProtectedRoutes from './components/Routes/ProtectedRoutes';
import { PATH } from './constants/path';
import { useTokenRefresh } from './hooks/common/useTokenRefresh';
Expand Down Expand Up @@ -119,20 +120,24 @@ const App: React.FC = () => {

<Route element={<ProtectedRoutes token={accessToken} />}>
<Route path={PATH.MYPAGE} element={<LayoutNoFooter />}>
<Route element={<MyPage />}>
<Route path="talkpick" element={<TalkPickLayout />}>
<Route path="bookmarks" element={<TalkPickBookmarks />} />
<Route path="written" element={<TalkPickWritten />} />
<Route path="votes" element={<TalkPickVotes />} />
<Route path="comments" element={<TalkPickComments />} />
{isMobile ? (
<Route index element={<MyMobilePage />} />
) : (
<Route element={<MyPage />}>
Comment on lines +123 to +126
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

현재 구현된 방식도 괜찮은 것 같습니다!! 👍

<Route path="talkpick" element={<TalkPickLayout />}>
<Route path="bookmarks" element={<TalkPickBookmarks />} />
<Route path="written" element={<TalkPickWritten />} />
<Route path="votes" element={<TalkPickVotes />} />
<Route path="comments" element={<TalkPickComments />} />
</Route>
<Route path="balancegame" element={<BalanceGameLayout />}>
<Route path="bookmarks" element={<BalanceGameBookmarks />} />
<Route path="votes" element={<BalanceGameVotes />} />
<Route path="written" element={<BalanceGameWritten />} />
</Route>
<Route index element={<TalkPickBookmarks />} />
</Route>
<Route path="balancegame" element={<BalanceGameLayout />}>
<Route path="bookmarks" element={<BalanceGameBookmarks />} />
<Route path="votes" element={<BalanceGameVotes />} />
<Route path="written" element={<BalanceGameWritten />} />
</Route>
<Route index element={<TalkPickBookmarks />} />
</Route>
)}
</Route>
<Route path="/" element={<Layout />}>
<Route path={PATH.CREATE.TALK_PICK} element={<CreatePostPage />} />
Expand Down
Binary file added src/assets/images/my-card-sample-first.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/my-card-sample-second.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ export { default as MobileDefaultPerson } from './svg/mobile-default-person.svg'
export { default as MobilePlus } from './svg/mobile-plus.svg';
export { default as MobileReport } from './svg/mobile-report.svg';
export { default as PickIcon } from './svg/pick-icon.svg';
export { default as MobileCardSampleFirst } from './images/my-card-sample-first.png';
export { default as MobileCardSampleSecond } from './images/my-card-sample-second.png';
export { default as SmileEmoji } from './svg/smile-emoji.svg';

// TODO: 이전 SVG
export { default as Email } from './svg/email.svg';
Expand Down
57 changes: 57 additions & 0 deletions src/assets/svg/smile-emoji.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
77 changes: 39 additions & 38 deletions src/components/atoms/MenuTap/MenuTap.style.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,39 @@
import { css } from '@emotion/react';
import color from '@/styles/color';
import typo from '@/styles/typo';

export const menuTapStyling = css({
display: 'flex',
flexDirection: 'column',
alignItems: 'flex-end',
});

export const menuIconStlying = css({
width: '11px',
height: '17px',
cursor: 'pointer',
});

export const menuStlying = css({
position: 'absolute',
marginTop: '23px',
marginRight: '4px',
width: '86px',
backgroundColor: color.WT,
border: `1px solid ${color.GY[2]}`,
borderRadius: '10px',
overflow: 'hidden',
boxShadow: '1px 2px 10px rgba(0, 0, 0, 0.07)',
});

export const menuItemStyling = css(typo.Comment.SemiBold, {
width: '100%',
padding: '10px',
cursor: 'pointer',
color: color.BK,
borderBottom: `1px solid ${color.GY[2]}`,
':last-child': {
borderBottom: 'none',
},
});
import { css } from '@emotion/react';
import color from '@/styles/color';
import typo from '@/styles/typo';

export const menuTapStyling = css({
display: 'flex',
flexDirection: 'column',
alignItems: 'flex-end',
});

export const menuIconStlying = css({
width: '11px',
height: '17px',
cursor: 'pointer',
});

export const menuStlying = css({
position: 'absolute',
marginTop: '23px',
marginRight: '4px',
minWidth: '86px',
width: 'max-content',
backgroundColor: color.WT,
border: `1px solid ${color.GY[2]}`,
borderRadius: '10px',
overflow: 'hidden',
boxShadow: '1px 2px 10px rgba(0, 0, 0, 0.07)',
});

export const menuItemStyling = css(typo.Comment.SemiBold, {
width: '100%',
padding: '10px',
cursor: 'pointer',
color: color.BK,
borderBottom: `1px solid ${color.GY[2]}`,
':last-child': {
borderBottom: 'none',
},
});
119 changes: 60 additions & 59 deletions src/components/atoms/MenuTap/MenuTap.tsx
Original file line number Diff line number Diff line change
@@ -1,59 +1,60 @@
import React, { useState, useEffect } from 'react';
import { Menu } from '@/assets';
import {
menuIconStlying,
menuItemStyling,
menuStlying,
menuTapStyling,
} from './MenuTap.style';

export type MenuItem = {
label?: string;
onClick?: () => void;
};

export interface MenuTapProps {
menuData: MenuItem[];
}

const MenuTap = ({ menuData }: MenuTapProps) => {
const [view, setView] = useState<boolean>(false);

const handleMenuClick = (e: React.MouseEvent) => {
e.stopPropagation();
setView(!view);
};

const handleOutsideClick = () => {
setView(false);
};

useEffect(() => {
window.addEventListener('click', handleOutsideClick);
return () => {
window.removeEventListener('click', handleOutsideClick);
};
}, []);

return (
<div css={menuTapStyling}>
<Menu css={menuIconStlying} onClick={handleMenuClick} />
{view && (
<div css={menuStlying}>
{menuData.map((item) => (
<button
type="button"
key={item.label}
css={menuItemStyling}
onClick={item?.onClick}
>
{item.label}
</button>
))}
</div>
)}
</div>
);
};

export default MenuTap;
import React, { useState, useEffect, ReactNode } from 'react';
import { Menu } from '@/assets';
import {
menuIconStlying,
menuItemStyling,
menuStlying,
menuTapStyling,
} from './MenuTap.style';

export type MenuItem = {
id: number;
label?: ReactNode;
onClick?: () => void;
};

export interface MenuTapProps {
menuData: MenuItem[];
}

const MenuTap = ({ menuData }: MenuTapProps) => {
Comment on lines +19 to +20
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

스토리북으로 확인해보니 글자 수가 같아도 메뉴가 1개일 때와 2개일 때의 width 길이가 차이가 나는 것 같아요!! 스타일 확인 부탁드립니닷

const [view, setView] = useState<boolean>(false);

const handleMenuClick = (e: React.MouseEvent) => {
e.stopPropagation();
setView(!view);
};

const handleOutsideClick = () => {
setView(false);
};

useEffect(() => {
window.addEventListener('click', handleOutsideClick);
return () => {
window.removeEventListener('click', handleOutsideClick);
};
}, []);

return (
<div css={menuTapStyling}>
<Menu css={menuIconStlying} onClick={handleMenuClick} />
{view && (
<div css={menuStlying}>
{menuData.map((item) => (
<button
type="button"
key={item.id}
css={menuItemStyling}
onClick={item?.onClick}
>
{item.label}
</button>
))}
</div>
)}
</div>
);
};

export default MenuTap;
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import type { Meta, StoryObj } from '@storybook/react';
import ProfileListItem from '@/components/mobile/molecules/ProfileListItem/ProfileListItem';
import { ProfileInfoSample } from '@/assets';
import { MemoryRouter } from 'react-router-dom';
import { storyContainer, storyInnerContainer } from '@/stories/story.styles';

const meta: Meta<typeof ProfileListItem> = {
Expand All @@ -21,6 +22,11 @@ const meta: Meta<typeof ProfileListItem> = {
description: '이미지 URL',
defaultValue: ProfileInfoSample,
},
to: {
control: 'text',
description: '이동할 경로',
defaultValue: '/talkpick/1',
},
},
};

Expand All @@ -31,22 +37,46 @@ export const Default: Story = {
args: {
title: '제목제목제목제목',
imgUrl: ProfileInfoSample,
to: '/talkpick/1',
},
render: (args) => (
<MemoryRouter>
<ProfileListItem {...args} />
</MemoryRouter>
),
};

export const All: Story = {
render: (args) => (
<ul css={storyContainer}>
<li css={storyInnerContainer}>
<ProfileListItem {...args} title="제목1" imgUrl={ProfileInfoSample} />
<ProfileListItem {...args} title="제목2" imgUrl={ProfileInfoSample} />
<ProfileListItem {...args} title="제목3" imgUrl={ProfileInfoSample} />
<ProfileListItem
{...args}
title="제목제목제목제목제목"
imgUrl={ProfileInfoSample}
/>
</li>
</ul>
<MemoryRouter>
<ul css={storyContainer}>
<li css={storyInnerContainer}>
<ProfileListItem
{...args}
title="제목1"
imgUrl={ProfileInfoSample}
to="/talkpick/1"
/>
<ProfileListItem
{...args}
title="제목2"
imgUrl={ProfileInfoSample}
to="/talkpick/2"
/>
<ProfileListItem
{...args}
title="제목3"
imgUrl={ProfileInfoSample}
to="/talkpick/3"
/>
<ProfileListItem
{...args}
title="제목제목제목제목제목"
imgUrl={ProfileInfoSample}
to="/talkpick/4"
/>
</li>
</ul>
</MemoryRouter>
),
};
Loading
Loading