-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
design: Toast pop up when Save success
- Loading branch information
Showing
5 changed files
with
55 additions
and
13 deletions.
There are no files selected for viewing
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,17 @@ | ||
// components/ToastComponent.tsx | ||
import React from 'react'; | ||
import useToastStore from '@/store/toastStore'; | ||
|
||
const ToastComponent: React.FC = () => { | ||
const showToast = useToastStore((state) => state.showToast); | ||
|
||
return showToast ? ( | ||
<div className="toast toast-start"> | ||
<div className="alert alert-success"> | ||
<span>성공적으로 저장되었습니다.</span> | ||
</div> | ||
</div> | ||
) : null; | ||
}; | ||
|
||
export default ToastComponent; |
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,14 @@ | ||
// stores/toastStore.ts | ||
import create from 'zustand'; | ||
|
||
interface ToastState { | ||
showToast: boolean; | ||
setShowToast: (isVisible: boolean) => void; | ||
} | ||
|
||
const useToastStore = create<ToastState>((set) => ({ | ||
showToast: false, | ||
setShowToast: (isVisible: boolean) => set({ showToast: isVisible }), | ||
})); | ||
|
||
export default useToastStore; |