-
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.
* chore : 스토리북 MemoryRouter 설정 * feat : 선택된 지도 편지 zustand * feat : 지도 편지 페이지 라우팅 및 페이지, 컴포넌트 수정 * chore : package.json * chore : color-name@npm 오류 해결 * chore : 스토리북 오류 해결 * chore : LetterContainer, MapLetterDetail 스토리북 오류 수정
- Loading branch information
Showing
9 changed files
with
1,519 additions
and
1,435 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
src/components/HomePage/LetterContainer/LetterContainer.stories.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
9 changes: 8 additions & 1 deletion
9
src/components/MapPage/LetterInfoContainer/LetterInfoContainer.stories.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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { create } from 'zustand'; | ||
|
||
type Letter = { | ||
id: number; | ||
longitude: number; | ||
latitude: number; | ||
title: string; | ||
keyword: string; | ||
date: string; | ||
}; | ||
|
||
type SelectedLetter = { | ||
selectedLetter: Letter | null; | ||
setSelectedLetter: (letter: Letter) => void; | ||
toggleSelectedLetter: (letter: Letter) => void; | ||
clearSelectedLetter: () => void; | ||
}; | ||
|
||
export const useSelectedLetterStore = create<SelectedLetter>((set) => ({ | ||
selectedLetter: null, | ||
setSelectedLetter: (letter) => set({ selectedLetter: letter }), | ||
toggleSelectedLetter: (letter) => | ||
set((state) => | ||
state.selectedLetter?.id === letter.id | ||
? { selectedLetter: null } | ||
: { selectedLetter: letter } | ||
), | ||
clearSelectedLetter: () => set({ selectedLetter: null }) | ||
})); |
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