Skip to content

Commit

Permalink
feat: add theme radio component
Browse files Browse the repository at this point in the history
  • Loading branch information
jonyw4 committed Nov 24, 2021
1 parent 93c4ff9 commit fda0a41
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions webapp/src/components/atoms/ThemeRadio/ThemeRadio.component.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Theme } from "../../../domain";
import { useTheme } from "../../global";

export function ThemeRadio() {
const {theme, changeTheme} = useTheme();

const isLight = theme === "light";
const isDark = theme === "dark";

return (
<div style={{ display: "flex" }}>
<label htmlFor="theme-light-radio">☀️ Light Theme</label>
<input
id="theme-light-radio"
type="radio"
name="theme"
value="light"
checked={isLight}
onClick={() => changeTheme("light")}
/>

<label htmlFor="theme-dark-radio">🌒 Dark Theme</label>
<input
id="theme-dark-radio"
type="radio"
name="theme"
value="dark"
checked={isDark}
onClick={() => changeTheme("dark")}
/>
</div>
);
}

0 comments on commit fda0a41

Please sign in to comment.