setShowNotepad(false)} />
>
);
}
diff --git a/src/components/modal/modal.module.css b/src/components/modal/modal.module.css
index 702c558..0dbf4f1 100644
--- a/src/components/modal/modal.module.css
+++ b/src/components/modal/modal.module.css
@@ -29,6 +29,13 @@
background-color: var(--color-neutral-100);
border-radius: 8px;
+ &.wide {
+ width: 95%;
+ max-width: 600px;
+ padding: 12px;
+ padding-top: 40px;
+ }
+
& .close {
position: absolute;
top: 10px;
diff --git a/src/components/modal/modal.tsx b/src/components/modal/modal.tsx
index c8b2824..e75e809 100644
--- a/src/components/modal/modal.tsx
+++ b/src/components/modal/modal.tsx
@@ -2,6 +2,7 @@ import { AnimatePresence, motion } from 'framer-motion';
import { IoClose } from 'react-icons/io5/index';
import { fade, mix, slideY } from '@/lib/motion';
+import { cn } from '@/helpers/styles';
import styles from './modal.module.css';
@@ -9,9 +10,10 @@ interface ModalProps {
children: React.ReactNode;
onClose: () => void;
show: boolean;
+ wide?: boolean;
}
-export function Modal({ children, onClose, show }: ModalProps) {
+export function Modal({ children, onClose, show, wide }: ModalProps) {
const variants = {
modal: mix(fade(), slideY(20)),
overlay: fade(),
@@ -33,7 +35,7 @@ export function Modal({ children, onClose, show }: ModalProps) {
{
useSoundStore.persist.rehydrate();
+ useNoteStore.persist.rehydrate();
}, []);
return <>{children}>;
diff --git a/src/components/toolbox/index.ts b/src/components/toolbox/index.ts
new file mode 100644
index 0000000..8a3fad5
--- /dev/null
+++ b/src/components/toolbox/index.ts
@@ -0,0 +1 @@
+export { Notepad } from './notepad';
diff --git a/src/components/toolbox/notepad/index.ts b/src/components/toolbox/notepad/index.ts
new file mode 100644
index 0000000..8a3fad5
--- /dev/null
+++ b/src/components/toolbox/notepad/index.ts
@@ -0,0 +1 @@
+export { Notepad } from './notepad';
diff --git a/src/components/toolbox/notepad/notepad.module.css b/src/components/toolbox/notepad/notepad.module.css
new file mode 100644
index 0000000..d9f53a3
--- /dev/null
+++ b/src/components/toolbox/notepad/notepad.module.css
@@ -0,0 +1,26 @@
+.header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ margin-bottom: 8px;
+
+ & .label {
+ font-size: var(--font-sm);
+ font-weight: 500;
+ color: var(--color-foreground-subtle);
+ }
+}
+
+.textarea {
+ width: 100%;
+ height: 350px;
+ padding: 12px;
+ line-height: 1.6;
+ color: var(--color-foreground-subtle);
+ resize: none;
+ background-color: var(--color-neutral-50);
+ border: 1px solid var(--color-neutral-200);
+ border-radius: 4px;
+ outline: none;
+ scroll-padding-bottom: 12px;
+}
diff --git a/src/components/toolbox/notepad/notepad.tsx b/src/components/toolbox/notepad/notepad.tsx
new file mode 100644
index 0000000..90ddeaa
--- /dev/null
+++ b/src/components/toolbox/notepad/notepad.tsx
@@ -0,0 +1,29 @@
+import { Modal } from '@/components/modal';
+
+import styles from './notepad.module.css';
+import { useNoteStore } from '@/store';
+
+interface NotepadProps {
+ onClose: () => void;
+ show: boolean;
+}
+
+export function Notepad({ onClose, show }: NotepadProps) {
+ const note = useNoteStore(state => state.note);
+ const write = useNoteStore(state => state.write);
+
+ return (
+
+
+
+
+ );
+}
diff --git a/src/store/index.ts b/src/store/index.ts
index dc1e1bb..0f7826f 100644
--- a/src/store/index.ts
+++ b/src/store/index.ts
@@ -1,2 +1,3 @@
export { useSoundStore } from './sound';
export { useLoadingStore } from './loading';
+export { useNoteStore } from './note';
diff --git a/src/store/note/index.ts b/src/store/note/index.ts
new file mode 100644
index 0000000..9ec59e5
--- /dev/null
+++ b/src/store/note/index.ts
@@ -0,0 +1,28 @@
+import { create } from 'zustand';
+import { createJSONStorage, persist } from 'zustand/middleware';
+import merge from 'deepmerge';
+
+import { type NoteState, createState } from './note.state';
+import { type NoteActions, createActions } from './note.actions';
+
+export const useNoteStore = create()(
+ persist(
+ (...a) => ({
+ ...createState(...a),
+ ...createActions(...a),
+ }),
+ {
+ merge: (persisted, current) =>
+ merge(
+ current,
+ // @ts-ignore
+ persisted,
+ ),
+ name: 'moodist-note',
+ partialize: state => ({ note: state.note }),
+ skipHydration: true,
+ storage: createJSONStorage(() => localStorage),
+ version: 0,
+ },
+ ),
+);
diff --git a/src/store/note/note.actions.ts b/src/store/note/note.actions.ts
new file mode 100644
index 0000000..ccf10ca
--- /dev/null
+++ b/src/store/note/note.actions.ts
@@ -0,0 +1,20 @@
+import type { StateCreator } from 'zustand';
+
+import type { NoteState } from './note.state';
+
+export interface NoteActions {
+ write: (note: string) => void;
+}
+
+export const createActions: StateCreator<
+ NoteActions & NoteState,
+ [],
+ [],
+ NoteActions
+> = set => {
+ return {
+ write(note) {
+ set({ note });
+ },
+ };
+};
diff --git a/src/store/note/note.state.ts b/src/store/note/note.state.ts
new file mode 100644
index 0000000..a2fde00
--- /dev/null
+++ b/src/store/note/note.state.ts
@@ -0,0 +1,18 @@
+import type { StateCreator } from 'zustand';
+
+import type { NoteActions } from './note.actions';
+
+export interface NoteState {
+ history: string | null;
+ note: string;
+}
+
+export const createState: StateCreator<
+ NoteState & NoteActions,
+ [],
+ [],
+ NoteState
+> = () => ({
+ history: null,
+ note: '',
+});