Yield generated for 1b34bdd3-e35c-4a55-a2c9-887f9903fbb9
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

25 lines
823 B

import clsx from 'clsx';
import { ReactElement } from 'react';
export const TodoItem = ({ status, label, onChecked }: { status: string; label: string; onChecked:(status: string) => void; }): ReactElement => {
return (
<div
className={clsx('p-4 flex items-center', {
'bg-gray-200': status === 'archived',
})}
>
<span
className={clsx('w-full block', { 'line-through': status !== 'open' })}
>
{label}
</span>
<input
checked={status !== 'open'}
disabled={status === 'archived'}
type="checkbox"
className="rounded text-pink-500 ml-8 cursor-pointer disabled:cursor-not-allowed disabled:bg-black disabled:hover:bg-black"
onChange={(): void => onChecked(status === 'open' ? 'done' : 'open')}
/>
</div>
);
};