-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
60622b9
commit 2ff50ac
Showing
8 changed files
with
99 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,4 @@ | |
"utils": "@/utils/css" | ||
} | ||
} | ||
|
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,24 @@ | ||
import { cn } from "@/utils/css"; | ||
import { IconType, IconSize, Icon } from "./icon"; | ||
|
||
export const IconButton = (props: { | ||
type: IconType; | ||
size: IconSize; | ||
onClick: () => void; | ||
className?: string; | ||
iconClassName?: string; | ||
}) => { | ||
const { type, size, onClick, className, iconClassName } = props; | ||
return ( | ||
<button | ||
className={cn( | ||
"hover:bg-accent rounded-md hover:text-accent-foreground p-1", | ||
className | ||
)} | ||
onClick={onClick} | ||
> | ||
<Icon type={type} size={size} className={iconClassName} /> | ||
</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
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,19 @@ | ||
type PenTool = { | ||
type: "pen"; | ||
settings: { | ||
color: string; | ||
size: number; | ||
}; | ||
}; | ||
|
||
type PencilTool = { | ||
type: "pencil"; | ||
settings: { | ||
color: string; | ||
size: number; | ||
}; | ||
}; | ||
|
||
export type DrawingTool = PenTool | PencilTool; | ||
export type DrawingToolType = DrawingTool["type"]; | ||
|
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,31 @@ | ||
import { DrawingToolType } from "@/drawing-tools"; | ||
import { create, type StateCreator } from "zustand"; | ||
import { persist, createJSONStorage } from "zustand/middleware"; | ||
|
||
type AppDrawingToolState = { | ||
selectedTool: DrawingToolType; | ||
}; | ||
|
||
const defaultState: AppDrawingToolState = { | ||
selectedTool: "pen", | ||
}; | ||
|
||
type AppDrawingToolSlice = AppDrawingToolState & { | ||
setSelectedTool: (type: DrawingToolType) => void; | ||
}; | ||
|
||
export const settingsStoreCreator: StateCreator<AppDrawingToolSlice> = ( | ||
set | ||
) => ({ | ||
...defaultState, | ||
setSelectedTool: (type: DrawingToolType) => set({ selectedTool: type }), | ||
}); | ||
|
||
export const useDrawingToolStore = create<AppDrawingToolSlice>()( | ||
persist(settingsStoreCreator, { | ||
version: 1, | ||
name: "drawing-tool", | ||
storage: createJSONStorage(() => sessionStorage), | ||
}) | ||
); | ||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export { useSettingsStore } from "./settingsStore"; | ||
export { useSessionStore } from "./sessionStore"; | ||
export { useDrawingToolStore } from "./drawingToolStore"; | ||
export { useWorkspacesStore } from "./workspacesStore"; | ||
|
This file was deleted.
Oops, something went wrong.