MCPcopy Create free account
hub / github.com/cesanta/mongoose / SwitchValue

Function SwitchValue

tutorials/http/device-dashboard/web_root/components.js:217–225  ·  view source on GitHub ↗
({value, setfn})

Source from the content-addressed store, hash-verified

215};
216
217export function SwitchValue({value, setfn}) {
218 const onclick = ev => setfn(!value);
219 const bg = !!value ? 'bg-blue-600' : 'bg-gray-200';
220 const tr = !!value ? 'translate-x-5' : 'translate-x-0';
221 return html`
222<button type="button" onclick=${onclick} class="${bg} inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-0 ring-0" role="switch" aria-checked=${!!value}>
223 <span aria-hidden="true" class="${tr} pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 focus:ring-0 transition duration-200 ease-in-out"></span>
224</button>`;
225};
226
227export function Setting(props) {
228 let input = TextValue;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected