diff --git a/client/App.jsx b/client/App.jsx index 30eefaa..fa674f7 100644 --- a/client/App.jsx +++ b/client/App.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; +import { BrowserRouter as Router, Route, Switch as RouteSwitch } from 'react-router-dom'; import Home from './Home'; import Badge from './layouts/badge/Details'; @@ -23,11 +23,12 @@ import SplitScreen from './layouts/split-screen/Details'; import StepperInput from './layouts/stepper-input/Details'; import StickyFooter from './layouts/sticky-footer/Details'; import StickyHeader from './layouts/sticky-header/Details'; +import Switch from './layouts/switch/Details'; const App = () => { return ( - + @@ -50,7 +51,8 @@ const App = () => { - + + ); }; diff --git a/client/Home.jsx b/client/Home.jsx index 6c1b3e9..286ab94 100644 --- a/client/Home.jsx +++ b/client/Home.jsx @@ -22,6 +22,7 @@ import SplitScreenCover from './layouts/split-screen/Cover'; import StepperInputCover from './layouts/stepper-input/Cover'; import StickyFooterCover from './layouts/sticky-footer/Cover'; import StickyHeaderCover from './layouts/sticky-header/Cover'; +import SwitchCover from './layouts/switch/Cover'; import Layout from './Layout'; import useDocumentTitle from './hooks/useDocumentTitle'; @@ -179,6 +180,12 @@ const Home = () => {

Stepper input

+
+ + +

Switch

+ +
diff --git a/client/layouts/switch/Cover.jsx b/client/layouts/switch/Cover.jsx new file mode 100644 index 0000000..fb8b1e9 --- /dev/null +++ b/client/layouts/switch/Cover.jsx @@ -0,0 +1,17 @@ +import React from 'react'; + +import Frame from '../../placeholders/Frame'; + +const Cover = () => { + return ( + +
+
+
+
+
+ + ); +}; + +export default Cover; diff --git a/client/layouts/switch/Details.jsx b/client/layouts/switch/Details.jsx new file mode 100644 index 0000000..78be163 --- /dev/null +++ b/client/layouts/switch/Details.jsx @@ -0,0 +1,75 @@ +import React, { useState } from 'react'; + +import DetailsLayout from '../../DetailsLayout'; +import BrowserFrame from '../../placeholders/BrowserFrame'; +import SampleCode from '../../SampleCode'; +import useDocumentTitle from '../../hooks/useDocumentTitle'; + +const Details = () => { + useDocumentTitle('CSS Layout ∙ Switch'); + const [checked, setChecked] = useState(false); + const toggle = () => setChecked(c => !c); + + return ( + +

Switch

+
The checkbox is placed inside a label. So when clicking on the label, the checkbox will be checked even though it's hidden.
+ +