Fix line endings

This commit is contained in:
Marshall Polaris 2022-06-05 18:57:49 -07:00
parent 004dd7168e
commit e712a054ae
2 changed files with 51 additions and 51 deletions

View File

@ -1,31 +1,31 @@
import clsx from 'clsx'
export function Checkbox(props: {
label: string
checked: boolean
toggle: (checked: boolean) => void
className?: string
}) {
const { label, checked, toggle, className } = props
return (
<div className={clsx(className, 'space-y-5')}>
<div className="relative flex items-start">
<div className="flex h-6 items-center">
<input
id={label}
type="checkbox"
className="h-5 w-5 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"
checked={checked}
onChange={(e) => toggle(!e.target.checked)}
/>
</div>
<div className="ml-3">
<label htmlFor={label} className="font-medium text-gray-700">
{label}
</label>
</div>
</div>
</div>
)
}
import clsx from 'clsx'
export function Checkbox(props: {
label: string
checked: boolean
toggle: (checked: boolean) => void
className?: string
}) {
const { label, checked, toggle, className } = props
return (
<div className={clsx(className, 'space-y-5')}>
<div className="relative flex items-start">
<div className="flex h-6 items-center">
<input
id={label}
type="checkbox"
className="h-5 w-5 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"
checked={checked}
onChange={(e) => toggle(!e.target.checked)}
/>
</div>
<div className="ml-3">
<label htmlFor={label} className="font-medium text-gray-700">
{label}
</label>
</div>
</div>
</div>
)
}

View File

@ -1,20 +1,20 @@
// A hook soon to be added to the React core library:
// https://github.com/reactjs/rfcs/blob/useevent/text/0000-useevent.md
// TODO: Once React adds this hook, use it instead.
import { useRef, useLayoutEffect, useCallback } from 'react'
type AnyFunction = (...args: any[]) => any
export function useEvent<T extends AnyFunction>(callback?: T) {
const ref = useRef<AnyFunction | undefined>(() => {
throw new Error('Cannot call an event handler while rendering.')
})
useLayoutEffect(() => {
ref.current = callback
})
return useCallback<AnyFunction>(
(...args) => ref.current?.apply(null, args),
[]
) as T
}
// A hook soon to be added to the React core library:
// https://github.com/reactjs/rfcs/blob/useevent/text/0000-useevent.md
// TODO: Once React adds this hook, use it instead.
import { useRef, useLayoutEffect, useCallback } from 'react'
type AnyFunction = (...args: any[]) => any
export function useEvent<T extends AnyFunction>(callback?: T) {
const ref = useRef<AnyFunction | undefined>(() => {
throw new Error('Cannot call an event handler while rendering.')
})
useLayoutEffect(() => {
ref.current = callback
})
return useCallback<AnyFunction>(
(...args) => ref.current?.apply(null, args),
[]
) as T
}