-
Notifications
You must be signed in to change notification settings - Fork 2
Feat(client): 메모 검색 모달 구현 #288
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
Open
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 @@ | ||
| export { default as MemoSearchModal } from './memo-search-modal'; |
70 changes: 70 additions & 0 deletions
70
apps/client/src/features/memo-search-modal/memo-search-modal.css.ts
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,70 @@ | ||
| import { style } from '@vanilla-extract/css'; | ||
|
|
||
| import { themeVars } from '@cds/ui'; | ||
|
|
||
| export const content = style({ | ||
| overflow: 'hidden', | ||
| width: '82rem', | ||
| height: '62rem', | ||
| border: `1px solid ${themeVars.color.grey400}`, | ||
| borderRadius: '16px', | ||
| boxShadow: '0 0 24px 8px rgba(0, 0, 0, 0.08)', | ||
| }); | ||
|
|
||
| export const container = style({ | ||
| display: 'flex', | ||
| flexDirection: 'column', | ||
| width: '100%', | ||
| height: '100%', | ||
| backgroundColor: themeVars.color.white, | ||
| }); | ||
|
|
||
| export const body = style({ | ||
| display: 'flex', | ||
| flexDirection: 'column', | ||
| gap: '0.4rem', | ||
| flex: 1, | ||
| minHeight: 0, | ||
| padding: '1.8rem 0.8rem 1.8rem 2rem', | ||
| }); | ||
|
|
||
| export const sectionTitle = style({ | ||
| padding: '0 1.4rem', | ||
| ...themeVars.fontStyles.body_m_14, | ||
| color: themeVars.color.grey600, | ||
| }); | ||
|
|
||
| export const list = style({ | ||
| display: 'flex', | ||
| flexDirection: 'column', | ||
| gap: '0.4rem', | ||
| flex: 1, | ||
| minHeight: 0, | ||
| overflowY: 'auto', | ||
| paddingRight: '1.2rem', | ||
| paddingLeft: '0.4rem', | ||
| scrollbarWidth: 'thin', | ||
| scrollbarColor: `${themeVars.color.grey300} transparent`, | ||
|
|
||
| selectors: { | ||
| '&::-webkit-scrollbar': { | ||
| width: '0.8rem', | ||
| }, | ||
| '&::-webkit-scrollbar-track': { | ||
| backgroundColor: 'transparent', | ||
| }, | ||
| '&::-webkit-scrollbar-thumb': { | ||
| border: 'none', | ||
| borderRadius: '999px', | ||
| backgroundColor: themeVars.color.grey300, | ||
| backgroundClip: 'border-box', | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| export const emptyText = style({ | ||
| ...themeVars.fontStyles.body_m_14, | ||
| padding: '4rem 0', | ||
| color: themeVars.color.grey500, | ||
| textAlign: 'center', | ||
| }); | ||
75 changes: 75 additions & 0 deletions
75
apps/client/src/features/memo-search-modal/memo-search-modal.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,75 @@ | ||||||||||||||
| import { Modal } from '@cds/ui'; | ||||||||||||||
|
|
||||||||||||||
| import MemoSearchListItem from './components/memo-search-list-item/memo-search-list-item'; | ||||||||||||||
| import SearchBar from './components/search-bar/search-bar'; | ||||||||||||||
| import { MemoSearchItemData } from './types'; | ||||||||||||||
|
|
||||||||||||||
| import * as styles from './memo-search-modal.css'; | ||||||||||||||
|
|
||||||||||||||
| const getSearchResultSectionTitle = (count: number) => { | ||||||||||||||
| return `검색 결과(${count}개)`; | ||||||||||||||
| }; | ||||||||||||||
|
|
||||||||||||||
| interface MemoSearchModalProps { | ||||||||||||||
| open: boolean; | ||||||||||||||
| searchValue: string; | ||||||||||||||
| recentMemos: MemoSearchItemData[]; | ||||||||||||||
| searchResultMemos?: MemoSearchItemData[]; | ||||||||||||||
| onOpenChange: (open: boolean) => void; | ||||||||||||||
| onChangeSearchValue: (value: string) => void; | ||||||||||||||
| onSearch: (value: string) => void; | ||||||||||||||
| onClickMemo: (memoId: number) => void; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| const MemoSearchModal = ({ | ||||||||||||||
| open, | ||||||||||||||
| searchValue, | ||||||||||||||
| recentMemos, | ||||||||||||||
| searchResultMemos, | ||||||||||||||
| onOpenChange, | ||||||||||||||
| onChangeSearchValue, | ||||||||||||||
| onSearch, | ||||||||||||||
| onClickMemo, | ||||||||||||||
| }: MemoSearchModalProps) => { | ||||||||||||||
| const isSearchResult = searchResultMemos !== undefined; | ||||||||||||||
| const memos = searchResultMemos ?? recentMemos; | ||||||||||||||
| const resultCount = searchResultMemos?.length ?? 0; | ||||||||||||||
| const sectionTitle = isSearchResult | ||||||||||||||
| ? getSearchResultSectionTitle(resultCount) | ||||||||||||||
| : '최근 열람한 메모'; | ||||||||||||||
|
Comment on lines
+37
to
+39
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
|
|
||||||||||||||
| return ( | ||||||||||||||
| <Modal open={open} onOpenChange={onOpenChange}> | ||||||||||||||
| <Modal.Content className={styles.content} ariaLabel="메모 검색"> | ||||||||||||||
| <div className={styles.container}> | ||||||||||||||
| <SearchBar | ||||||||||||||
| value={searchValue} | ||||||||||||||
| onChange={onChangeSearchValue} | ||||||||||||||
| onSearch={onSearch} | ||||||||||||||
| /> | ||||||||||||||
| <div className={styles.body}> | ||||||||||||||
| {memos.length > 0 ? ( | ||||||||||||||
| <> | ||||||||||||||
| <span className={styles.sectionTitle}>{sectionTitle}</span> | ||||||||||||||
| <div className={styles.list}> | ||||||||||||||
| {memos.map((memo) => ( | ||||||||||||||
| <MemoSearchListItem | ||||||||||||||
| key={memo.memoId} | ||||||||||||||
| memo={memo} | ||||||||||||||
| onClickMemo={onClickMemo} | ||||||||||||||
| /> | ||||||||||||||
| ))} | ||||||||||||||
| </div> | ||||||||||||||
| </> | ||||||||||||||
| ) : ( | ||||||||||||||
| // TODO: empty view 컴포넌트 디자인 확정되는 대로 교체 예정 | ||||||||||||||
| <p className={styles.emptyText}>표시할 메모가 없습니다.</p> | ||||||||||||||
| )} | ||||||||||||||
| </div> | ||||||||||||||
| </div> | ||||||||||||||
| </Modal.Content> | ||||||||||||||
| </Modal> | ||||||||||||||
| ); | ||||||||||||||
| }; | ||||||||||||||
|
|
||||||||||||||
| export default MemoSearchModal; | ||||||||||||||
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,9 @@ | ||
| import { TagDisplayInfo } from '@shared/types/tag'; | ||
|
|
||
| export interface MemoSearchItemData { | ||
| memoId: number; | ||
| title: string; | ||
| content: string; | ||
| openedAt: string; | ||
| tags?: TagDisplayInfo[]; | ||
| } |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
body에 상하좌우 동일하게 패딩 넣고 list에서 패딩 설정하지 않아도 될 것 같은데 나눠서 스타일 적용한것이 궁금합니da🎃