diff --git a/demo/DemoApp.tsx b/demo/DemoApp.tsx index e90abc4..101c959 100644 --- a/demo/DemoApp.tsx +++ b/demo/DemoApp.tsx @@ -22,6 +22,7 @@ import {MainMenuItemSubmenu, MainMenuLink} from "../src/Components/Menus/MainMen import {AppItem, AppLink, AppsMenu} from "../src/Components/Menus/AppsMenu"; import {Application} from "../src/Application/Application"; import {Outlet} from "react-router-dom"; +import {ToggleSwitch} from "../src/Components/Forms/ToggleSwitch"; export function DemoApp() { @@ -120,6 +121,7 @@ export function DemoApp()

Currently selected datetime: {datetime ? datetime.toISOString() : "none"}

Checkbox demo + Toggle switch demo Radio box test Radio box test diff --git a/src/Components/Forms/ToggleSwitch.tsx b/src/Components/Forms/ToggleSwitch.tsx new file mode 100644 index 0000000..25c8420 --- /dev/null +++ b/src/Components/Forms/ToggleSwitch.tsx @@ -0,0 +1,14 @@ +import React from "react"; +import {Check} from "@phosphor-icons/react"; +import {classes} from "../../Utils"; + +export function ToggleSwitch({children, className, type, ...inputProps}: React.PropsWithChildren>): React.ReactElement +{ + return ( + + ); +} diff --git a/src/styles/components/forms/_box.less b/src/styles/components/forms/_box.less index b3f9aa4..95c4603 100644 --- a/src/styles/components/forms/_box.less +++ b/src/styles/components/forms/_box.less @@ -1,4 +1,4 @@ -label.box +label.box, label.toggleswitch { display: block; @@ -50,3 +50,35 @@ label.box background: var(--background-lighter); } } + +label.toggleswitch +{ + > .button + { + display: inline-flex; + align-items: center; + width: 2.5em; + + > .switch + { + transition: margin-left 0.25s ease, box-shadow 0.25s ease; + + display: inline-block; + + margin: auto 0.25em; + width: 0.9em; + height: 0.8em; + border-radius: 0.25em; + box-shadow: 0 0 0 0 var(--foreground-shadow); + border: solid var(--background-darkest) thin; + background: var(--background); + } + } + + > input:checked + .button > .switch + { + margin-left: 1.2em; + border-color: transparent; + box-shadow: 0 0 0.4em 0 var(--foreground-shadow); + } +}