Skip to content

Commit

Permalink
Added back the theme toggler
Browse files Browse the repository at this point in the history
  • Loading branch information
rohit20v committed Jan 1, 2025
1 parent 12ae6fd commit 852fb14
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions src/components/ToolPickerContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {useColorPicker} from "../hooks/useColorPicker.ts";
import {ColorPickerTool} from "./ColorPickerTool.tsx";
import {Stage} from "konva/lib/Stage";
import {RiDeleteBin2Fill} from "react-icons/ri";
import {ThemeToggler} from "./ThemeToggler.tsx";
import {useTheme} from "../hooks/useTheme.ts";

const ToolPickerContainer = ({tool, setTool, stageRef, setSelectedColor, setStrokeWidth, setShapes}: {
tool: string,
Expand All @@ -21,13 +23,12 @@ const ToolPickerContainer = ({tool, setTool, stageRef, setSelectedColor, setStro
}) => {

const {selectedColor, isPickerVisible, togglePicker, handleColorChange} = useColorPicker();
// const {theme, setTheme} = useTheme();
const {theme, setTheme} = useTheme();
const [strokeSize, setStrokeSize] = useState<number>(2)

// todo fix theme toggling
// const toggleTheme = () => {
// setTheme(theme === 'dark' ? 'light' : 'dark');
// };
const toggleTheme = () => {
setTheme(theme === 'dark' ? 'light' : 'dark');
};

useEffect(() => {
setSelectedColor(selectedColor)
Expand Down Expand Up @@ -76,17 +77,12 @@ const ToolPickerContainer = ({tool, setTool, stageRef, setSelectedColor, setStro
onToggle={togglePicker}/>
<input type="range" min={0} max={24} value={strokeSize}
onChange={(event) => setStrokeSize(Number(event.target.value))}/>
<Tool isSelected={false}>
<RiDeleteBin2Fill color={"black"} size={22} onClick={setShapes}/>
</Tool>

<ThemeToggler onClick={toggleTheme} theme={theme}/>

{/*<ThemeToggler onClick={toggleTheme} theme={theme}/>*/}
<div
style={{
boxShadow: "0 4px 16px 0 gray",
borderRadius: "8px"
}}>
<Tool isSelected={false}>
<RiDeleteBin2Fill color={"black"} size={22} onClick={setShapes}/>
</Tool>
</div>
</div>
</div>
</>
Expand Down

0 comments on commit 852fb14

Please sign in to comment.