Skip to content

Commit 55f134d

Browse files
checkpoint
1 parent 0336e14 commit 55f134d

File tree

2 files changed

+105
-0
lines changed

2 files changed

+105
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import React from "react";
2+
import FloatingButton from "./FloatingButton";
3+
4+
interface DevPanelProps {
5+
devMode: boolean;
6+
setDevMode: (mode: boolean) => void;
7+
theme: "light" | "dark";
8+
setTheme: (theme: "light" | "dark") => void;
9+
}
10+
11+
const DevPanel: React.FC<DevPanelProps> = ({
12+
devMode,
13+
setDevMode,
14+
theme,
15+
setTheme,
16+
}) => {
17+
return (
18+
<>
19+
{/* Floating Dev Mode Button */}
20+
<FloatingButton
21+
onClick={() => setDevMode(!devMode)}
22+
backgroundColor={devMode ? "oklch(60% 0.2 250)" : "oklch(40% 0.2 250)"}
23+
offset={{ x: 20, y: 20 }}
24+
>
25+
{devMode ? "Disable" : "Enable"} Dev Mode
26+
</FloatingButton>
27+
28+
{/* Floating Theme Toggle Button */}
29+
<FloatingButton
30+
onClick={() => setTheme(theme === "dark" ? "light" : "dark")}
31+
backgroundColor={
32+
theme === "dark" ? "oklch(60% 0.2 50)" : "oklch(40% 0.2 50)"
33+
}
34+
offset={{ x: 200, y: 20 }}
35+
>
36+
{theme === "dark" ? "☀️ Light" : "🌙 Dark"} Mode
37+
</FloatingButton>
38+
</>
39+
);
40+
};
41+
42+
export default DevPanel;
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import React from "react";
2+
3+
interface FloatingButtonProps {
4+
onClick: () => void;
5+
children: React.ReactNode;
6+
position?: "top-right" | "top-left" | "bottom-right" | "bottom-left";
7+
offset?: { x: number; y: number };
8+
backgroundColor?: string;
9+
color?: string;
10+
zIndex?: number;
11+
}
12+
13+
const FloatingButton: React.FC<FloatingButtonProps> = ({
14+
onClick,
15+
children,
16+
position = "top-right",
17+
offset = { x: 20, y: 20 },
18+
backgroundColor = "oklch(40% 0.2 250)",
19+
color = "white",
20+
zIndex = 1000,
21+
}) => {
22+
const getPositionStyles = () => {
23+
switch (position) {
24+
case "top-left":
25+
return { top: offset.y, left: offset.x };
26+
case "bottom-right":
27+
return { bottom: offset.y, right: offset.x };
28+
case "bottom-left":
29+
return { bottom: offset.y, left: offset.x };
30+
default:
31+
return { top: offset.y, right: offset.x };
32+
}
33+
};
34+
35+
return (
36+
<button
37+
onClick={onClick}
38+
style={{
39+
position: "fixed",
40+
...getPositionStyles(),
41+
zIndex,
42+
padding: "8px 16px",
43+
background: backgroundColor,
44+
color,
45+
border: "none",
46+
borderRadius: "4px",
47+
cursor: "pointer",
48+
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.3)",
49+
transition: "all 0.2s ease",
50+
}}
51+
onMouseEnter={(e) => {
52+
e.currentTarget.style.transform = "scale(1.05)";
53+
}}
54+
onMouseLeave={(e) => {
55+
e.currentTarget.style.transform = "scale(1)";
56+
}}
57+
>
58+
{children}
59+
</button>
60+
);
61+
};
62+
63+
export default FloatingButton;

0 commit comments

Comments
 (0)