-
Notifications
You must be signed in to change notification settings - Fork 0
[Feat] 팔로잉 페이지 제작 #92
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
Merged
Merged
Changes from 10 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
7bbb68f
style: message 페이지 디자인
wooktori c1bf641
style: 팔로잉 페이지 UI 작업
wooktori f5e0762
fix: 폴더명 수정
wooktori 49b8ac3
fix: import 오류 수정
wooktori 2fbbf5d
feat: Following List test 작성
wooktori 1f07c42
feat: following search 테스트 작성
wooktori e997363
fix: test 수정
wooktori d3c430b
fix: import 수정
wooktori f801a1e
Merge branch 'main' into hwanwook-feat/message
wooktori b85efd9
fix: tab 관련 코드 수정
wooktori a674eb2
fix: key 값 수정
wooktori 2bba135
Merge branch 'main' into hwanwook-feat/message
wooktori cddadbd
fix: key값 관련 오류 수정
wooktori f75182f
Merge branch 'main' into hwanwook-feat/message
wooktori 6085c11
Merge branch 'main' into hwanwook-feat/message
wooktori File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import { TabNavigation } from '@/components/shared'; | ||
|
|
||
| const SOCIAL_TABS = [ | ||
| { label: '팔로잉', value: 'following' }, | ||
| { label: '메세지', value: 'chat' }, | ||
| ]; | ||
|
|
||
| export default function ChatPage() { | ||
| return ( | ||
| <div className='min-h-screen bg-[#F1F5F9]'> | ||
| <TabNavigation basePath='/message' tabs={SOCIAL_TABS} /> | ||
| <section className='flex w-full flex-col gap-4 px-4 py-4'> | ||
| <h2 className='text-h2-bold'>채팅 페이지</h2> | ||
| </section> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import { FollowingList, FollowingSearch } from '@/components/pages/message'; | ||
| import { TabNavigation } from '@/components/shared'; | ||
|
|
||
| const SOCIAL_TABS = [ | ||
| { label: '팔로잉', value: 'following' }, | ||
| { label: '메세지', value: 'chat' }, | ||
| ]; | ||
|
|
||
| const FOLLOWING_LIST = [ | ||
| { | ||
| name: '신짱구', | ||
| profileImage: '', | ||
| profileMessage: '안녕하세요 신짱구입니다', | ||
| }, | ||
| { | ||
| name: '신짱구', | ||
| profileImage: '', | ||
| profileMessage: '안녕하세요 신짱구입니다', | ||
| }, | ||
| { | ||
| name: '신짱구', | ||
| profileImage: '', | ||
| profileMessage: '안녕하세요 신짱구입니다', | ||
| }, | ||
| ]; | ||
|
|
||
| export default function FollowingPage() { | ||
| return ( | ||
| <div className='min-h-screen bg-[#F1F5F9]'> | ||
| <TabNavigation basePath='/message' tabs={SOCIAL_TABS} /> | ||
| <FollowingSearch /> | ||
| <FollowingList items={FOLLOWING_LIST} /> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| import FollowingCard from './message-followingCard'; | ||
|
|
||
| export { FollowingCard }; | ||
| export { FollowingCard } from './message-following-card'; | ||
| export { FollowingList } from './message-following-list'; | ||
| export { FollowingSearch } from './message-following-search'; |
2 changes: 1 addition & 1 deletion
2
...e/message-followingCard/index.stories.tsx → .../message-following-card/index.stories.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...sage/message-followingCard/index.test.tsx → ...age/message-following-card/index.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/components/pages/message/message-following-list/index.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import { render, screen } from '@testing-library/react'; | ||
|
|
||
| import { FollowingList } from '.'; | ||
|
|
||
| const TEST_ITEMS = [ | ||
| { | ||
| name: '신짱구', | ||
| profileImage: 'http://test.com', | ||
| profileMessage: '안녕하세요 신짱구입니다', | ||
| }, | ||
| { | ||
| name: '김맹구', | ||
| profileImage: 'http://test.com', | ||
| profileMessage: '안녕하세요 김맹구입니다', | ||
| }, | ||
|
|
||
| { | ||
| name: '흰둥이', | ||
| profileImage: 'http://test.com', | ||
| profileMessage: '안녕하세요 흰둥이입니다', | ||
| }, | ||
| ]; | ||
|
|
||
| describe('Following List 컴포넌트 테스트', () => { | ||
| test('모든 아이템이 렌더링 되는지 테스트', () => { | ||
| render(<FollowingList items={TEST_ITEMS} />); | ||
|
|
||
| TEST_ITEMS.forEach((item) => { | ||
| expect(screen.getByText(item.name)).toBeInTheDocument(); | ||
| }); | ||
| }); | ||
| }); |
29 changes: 29 additions & 0 deletions
29
src/components/pages/message/message-following-list/index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| 'use client'; | ||
|
|
||
| import { FollowingCard } from '../message-following-card'; | ||
|
|
||
| interface FollowingItem { | ||
| name: string; | ||
| profileImage: string; | ||
| profileMessage: string; | ||
| } | ||
|
|
||
| interface FollowingListProps { | ||
| items: FollowingItem[]; | ||
| } | ||
|
|
||
| export const FollowingList = ({ items }: FollowingListProps) => { | ||
| return ( | ||
| <div> | ||
| {items.map((item, index) => ( | ||
| <FollowingCard | ||
| key={index} | ||
| name={item.name} | ||
| profileImage={item.profileImage} | ||
| profileMessage={item.profileMessage} | ||
| type='following' | ||
| /> | ||
| ))} | ||
| </div> | ||
| ); | ||
| }; | ||
31 changes: 31 additions & 0 deletions
31
src/components/pages/message/message-following-search/index.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { fireEvent, render, screen } from '@testing-library/react'; | ||
|
|
||
| import { ModalProvider } from '@/components/ui'; | ||
|
|
||
| import { FollowingSearch } from '.'; | ||
|
|
||
| describe('Following Search 테스트', () => { | ||
| test('Following Search 렌더링 테스트', () => { | ||
| render( | ||
| <ModalProvider> | ||
| <FollowingSearch /> | ||
| </ModalProvider>, | ||
| ); | ||
|
|
||
| expect(screen.getByText('팔로우 추가')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| test('팔로우 추가 클릭 시 모달 생성', () => { | ||
| render( | ||
| <ModalProvider> | ||
| <FollowingSearch /> | ||
| </ModalProvider>, | ||
| ); | ||
|
|
||
| expect(screen.queryByText('팔로우 할 닉네임을 입력하세요')).toBeNull(); | ||
|
|
||
| fireEvent.click(screen.getByText('팔로우 추가')); | ||
|
|
||
| expect(screen.getByText('팔로우 할 닉네임을 입력하세요')).toBeInTheDocument(); | ||
| }); | ||
| }); |
54 changes: 54 additions & 0 deletions
54
src/components/pages/message/message-following-search/index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| 'use client'; | ||
| import { Icon } from '@/components/icon'; | ||
| import { Button, ModalContent, ModalTitle, useModal } from '@/components/ui'; | ||
|
|
||
| const FollowerModal = () => { | ||
| const { close } = useModal(); | ||
|
|
||
| const handleConfirm = () => { | ||
| // 유저 팔로우 기능 ... | ||
| console.log('팔로우 성공'); | ||
| close(); | ||
| }; | ||
|
|
||
| // 모달 모양 바뀌면 적용하기! | ||
| return ( | ||
| <ModalContent> | ||
| <ModalTitle className='mb-3'>팔로우 할 닉네임을 입력하세요</ModalTitle> | ||
| <input | ||
| className='text-text-sm-medium mb-3 w-full rounded-3xl bg-gray-100 px-4 py-2.5 text-gray-800' | ||
| placeholder='nickname' | ||
| onKeyDown={(e) => { | ||
| if (e.key === 'Enter') { | ||
| handleConfirm(); | ||
| } | ||
| }} | ||
| /> | ||
|
|
||
| <div className='flex w-full flex-row gap-2'> | ||
| <Button size='sm' variant='tertiary' onClick={close}> | ||
| 취소 | ||
| </Button> | ||
| <Button size='sm' onClick={handleConfirm}> | ||
| 팔로우 | ||
| </Button> | ||
| </div> | ||
| </ModalContent> | ||
| ); | ||
| }; | ||
|
|
||
| export const FollowingSearch = () => { | ||
| const { open } = useModal(); | ||
| return ( | ||
| <div | ||
| className='flex items-center gap-5 px-5 py-4 transition-all hover:cursor-pointer hover:opacity-80' | ||
| onClick={() => open(<FollowerModal />)} | ||
| > | ||
| <div className='rounded-full border-2 border-dashed border-gray-400 bg-gray-100 p-2'> | ||
| <Icon id='plus' className='size-6 text-gray-700' /> | ||
| </div> | ||
|
|
||
| <span className='text-text-md-bold'>팔로우 추가</span> | ||
| </div> | ||
| ); | ||
| }; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.