mirror of
https://github.com/wasp-lang/open-saas.git
synced 2025-04-01 00:18:19 +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';
|
||||
|
||||
const SwitcherOne = ({ isOn, onChange }: { isOn: boolean; onChange: (value: boolean) => void }) => {
|
||||
const id = useId();
|
||||
|
||||
return (
|
||||
<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'>
|
||||
<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={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';
|
||||
|
||||
const SwitcherTwo = ({ isOn, onChange }: { isOn: boolean; onChange: (value: boolean) => void }) => {
|
||||
const id = useId();
|
||||
|
||||
return (
|
||||
<div>
|
||||
<label className='flex cursor-pointer select-none items-center'>
|
||||
<label htmlFor={id} className='flex cursor-pointer select-none items-center'>
|
||||
<div className='relative'>
|
||||
<input
|
||||
type='checkbox'
|
||||
id='toggle3'
|
||||
className='sr-only'
|
||||
onChange={(e) => onChange(e.target.checked)}
|
||||
/>
|
||||
<input type='checkbox' id={id} 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={cn(
|
||||
|
Loading…
x
Reference in New Issue
Block a user