mirror of
https://github.com/wasp-lang/open-saas.git
synced 2025-06-16 03:40:51 +02:00
Collect switcher labels and inputs with IDs
This commit is contained in:
parent
3adfacc5ed
commit
d64dff82d2
@ -1,11 +1,14 @@
|
|||||||
|
import { useId } from 'react';
|
||||||
import { cn } from '../../../client/cn';
|
import { cn } from '../../../client/cn';
|
||||||
|
|
||||||
const SwitcherOne = ({ isOn, onChange }: { isOn: boolean; onChange: (value: boolean) => void }) => {
|
const SwitcherOne = ({ isOn, onChange }: { isOn: boolean; onChange: (value: boolean) => void }) => {
|
||||||
|
const id = useId();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='relative'>
|
<div className='relative'>
|
||||||
<label className='flex cursor-pointer select-none items-center'>
|
<label htmlFor={id} className='flex cursor-pointer select-none items-center'>
|
||||||
<div className='relative'>
|
<div className='relative'>
|
||||||
<input type='checkbox' className='sr-only' onChange={(e) => onChange(e.target.checked)} />
|
<input id={id} type='checkbox' className='sr-only' onChange={(e) => onChange(e.target.checked)} />
|
||||||
<div className='reblock h-8 w-14 rounded-full bg-meta-9 dark:bg-[#5A616B]'></div>
|
<div className='reblock h-8 w-14 rounded-full bg-meta-9 dark:bg-[#5A616B]'></div>
|
||||||
<div
|
<div
|
||||||
className={cn('absolute left-1 top-1 h-6 w-6 rounded-full bg-white dark:bg-gray-400 transition', {
|
className={cn('absolute left-1 top-1 h-6 w-6 rounded-full bg-white dark:bg-gray-400 transition', {
|
||||||
|
@ -1,16 +1,14 @@
|
|||||||
|
import { useId } from 'react';
|
||||||
import { cn } from '../../../client/cn';
|
import { cn } from '../../../client/cn';
|
||||||
|
|
||||||
const SwitcherTwo = ({ isOn, onChange }: { isOn: boolean; onChange: (value: boolean) => void }) => {
|
const SwitcherTwo = ({ isOn, onChange }: { isOn: boolean; onChange: (value: boolean) => void }) => {
|
||||||
|
const id = useId();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<label className='flex cursor-pointer select-none items-center'>
|
<label htmlFor={id} className='flex cursor-pointer select-none items-center'>
|
||||||
<div className='relative'>
|
<div className='relative'>
|
||||||
<input
|
<input type='checkbox' id={id} className='sr-only' onChange={(e) => onChange(e.target.checked)} />
|
||||||
type='checkbox'
|
|
||||||
id='toggle3'
|
|
||||||
className='sr-only'
|
|
||||||
onChange={(e) => onChange(e.target.checked)}
|
|
||||||
/>
|
|
||||||
<div className='block h-8 w-14 rounded-full bg-meta-9 dark:bg-[#5A616B]'></div>
|
<div className='block h-8 w-14 rounded-full bg-meta-9 dark:bg-[#5A616B]'></div>
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user