-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
feat: 별별 저장소 페이지 UI 작업
- Loading branch information
Showing
21 changed files
with
249 additions
and
72 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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,67 @@ | ||
'use client' | ||
import { words } from '@/components/shared/WordListItem/data' | ||
import TabFilter from '@/components/domain/dictionary/TabFilter' | ||
import Header from '@/components/shared/Header' | ||
import TopButton from '@/components/shared/TopButton' | ||
import { FilterType, SimpleWordType } from '@/types/word' | ||
import { useSearchParams } from 'next/navigation' | ||
import WordListItem from '@/components/shared/WordListItem' | ||
import Link from 'next/link' | ||
import Image from 'next/image' | ||
import EmptyLayout from '@/components/shared/EmptyLayout' | ||
|
||
export default function BookmarksPage() { | ||
const searchParams = useSearchParams() | ||
const filters: FilterType[] = ['전체', '개발', '디자인', '비즈니스'] | ||
const category: any = searchParams.get('category') ?? '전체' | ||
const wordCount = words.length | ||
|
||
return ( | ||
<> | ||
<Header title="별별 저장소" /> | ||
{wordCount === 0 ? ( | ||
<div className="h-[calc(100%-90px)]"> | ||
<EmptyLayout target="bookmarks" /> | ||
</div> | ||
) : ( | ||
<div className="relative overflow-y-auto bg-background text-onSurface-300"> | ||
<div className="flex gap-2 px-4 pt-1 mb-5"> | ||
{filters.map((filter: FilterType, idx: number) => ( | ||
<TabFilter | ||
isSelected={filter === category} | ||
filter={filter} | ||
key={idx} | ||
/> | ||
))} | ||
</div> | ||
<div className="px-4 mb-2"> | ||
<p className="text-body3 text-onSurface-200 mb-4"> | ||
나만의 별 단어 {wordCount} | ||
</p> | ||
<Link | ||
href={'/dictionary'} | ||
className="flex justify-between p-4 rounded-lg bg-gray-800 hover:bg-gray-700" | ||
> | ||
<p className="text-sub3"> | ||
<span className="text-primary-400">별 단어</span>라고 생각이 | ||
드는 실무 용어를 더 추가해보세요. | ||
</p> | ||
<Image | ||
alt="dictionary" | ||
width={20} | ||
height={20} | ||
src={'/icons/right_arrow.svg'} | ||
/> | ||
</Link> | ||
</div> | ||
|
||
{words.map((word: SimpleWordType, idx: number) => ( | ||
<WordListItem key={word.id} word={word} isMarked showBookmarkBtn /> | ||
))} | ||
</div> | ||
)} | ||
|
||
<TopButton /> | ||
</> | ||
) | ||
} |
This file contains 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 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 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 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 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
4 changes: 2 additions & 2 deletions
4
src/components/domain/home/dictionary/RecentlyAddedWords/data.ts
This file contains 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
6 changes: 3 additions & 3 deletions
6
src/components/domain/home/dictionary/RecentlyAddedWords/index.tsx
This file contains 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 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 was deleted.
Oops, something went wrong.
This file contains 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 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,33 @@ | ||
'use client' | ||
import Image from 'next/image' | ||
|
||
type BookmarkButtonProps = { | ||
wordId: number | ||
isMarked: boolean | ||
markCount?: number | ||
} | ||
|
||
export default function BookmarkButton({ | ||
wordId, | ||
isMarked, | ||
markCount, | ||
}: BookmarkButtonProps) { | ||
const handleClick = (e: React.MouseEvent) => { | ||
e.preventDefault() | ||
alert(`${wordId} 북마크`) | ||
} | ||
return ( | ||
<button> | ||
<Image | ||
alt="bookmark" | ||
src={ | ||
isMarked ? '/icons/bookmark_fill.svg' : '/icons/bookmark_outline.svg' | ||
} | ||
width={24} | ||
height={24} | ||
onClick={handleClick} | ||
/> | ||
<p className="text-caption text-onSurface-200">{markCount}</p> | ||
</button> | ||
) | ||
} |
This file contains 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,53 @@ | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
import Header from '.' | ||
import { | ||
AppRouterContext, | ||
type AppRouterInstance, | ||
} from 'next/dist/shared/lib/app-router-context.shared-runtime' | ||
import BookmarkButton from '../BookmarkButton' | ||
|
||
const meta: Meta<typeof Header> = { | ||
title: 'components/Header', | ||
component: Header, | ||
tags: ['autodocs'], | ||
decorators: [ | ||
(Story) => ( | ||
<AppRouterContext.Provider value={{} as AppRouterInstance}> | ||
<Story /> | ||
</AppRouterContext.Provider> | ||
), | ||
], | ||
argTypes: { | ||
title: { | ||
description: '헤더 중앙에 표기할 텍스트를 작성합니다.', | ||
}, | ||
rightItem: { | ||
description: '헤더 맨 우측에 표기할 요소를 작성합니다.', | ||
}, | ||
}, | ||
} | ||
|
||
export default meta | ||
|
||
type Story = StoryObj<typeof Header> | ||
|
||
export const Default: Story = { | ||
args: { | ||
title: '실무 용어', | ||
}, | ||
} | ||
|
||
export const HeaderWithRightItem: Story = { | ||
render: () => ( | ||
<> | ||
<Header | ||
title="실무 용어" | ||
rightItem={<BookmarkButton isMarked={false} markCount={8} wordId={2} />} | ||
/> | ||
<Header | ||
title="실무 용어" | ||
rightItem={<BookmarkButton isMarked={true} markCount={34} wordId={1} />} | ||
/> | ||
</> | ||
), | ||
} |
This file contains 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,26 @@ | ||
'use client' | ||
import Image from 'next/image' | ||
import { useRouter } from 'next/navigation' | ||
|
||
type HeaderProps = { | ||
title: string | ||
rightItem?: React.ReactNode | ||
} | ||
|
||
export default function Header({ title, rightItem }: HeaderProps) { | ||
const router = useRouter() | ||
return ( | ||
<header className="w-full h-[90px] sticky top-0 flex justify-between items-start pt-8 pb-4 px-4 z-50 bg-background text-onSurface-300"> | ||
<Image | ||
alt="back" | ||
src={'/icons/left_arrow.svg'} | ||
width={24} | ||
height={24} | ||
className="cursor-pointer" | ||
onClick={() => router.back()} | ||
/> | ||
<p className="text-sub1">{title}</p> | ||
{rightItem ?? <div className="text-center w-6 h-6"></div>} | ||
</header> | ||
) | ||
} |
Oops, something went wrong.