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

Function SelectValue

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

Source from the content-addressed store, hash-verified

206};
207
208export function SelectValue({value, setfn, options, disabled}) {
209 const toInt = x => x == parseInt(x) ? parseInt(x) : x;
210 const onchange = ev => setfn(toInt(ev.target.value));
211 return html`
212<select onchange=${onchange} class="w-full rounded font-normal border py-0.5 px-1 text-gray-600 focus:outline-none text-sm disabled:cursor-not-allowed" disabled=${disabled}>
213 ${options.map(v => html`<option value=${v[0]} selected=${v[0] == value}>${v[1]}<//>`) }
214<//>`;
215};
216
217export function SwitchValue({value, setfn}) {
218 const onclick = ev => setfn(!value);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected