2021-01-01 00:27:16 +00:00
|
|
|
import Input from '@/components/elements/Input';
|
|
|
|
import React from 'react';
|
2021-07-22 17:15:27 +00:00
|
|
|
import tw, { styled } from 'twin.macro';
|
2021-01-01 00:27:16 +00:00
|
|
|
|
2021-01-01 22:55:30 +00:00
|
|
|
export const TableCheckbox = styled(Input)`
|
2021-01-01 00:27:16 +00:00
|
|
|
&& {
|
|
|
|
${tw`border-neutral-500 bg-transparent`};
|
|
|
|
|
|
|
|
&:not(:checked) {
|
|
|
|
${tw`hover:border-neutral-300`};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2021-01-01 22:55:30 +00:00
|
|
|
export default ({ name, checked, onChange }: { name: string, checked: boolean, onChange(e: React.ChangeEvent<HTMLInputElement>): void }) => {
|
2021-01-01 00:27:16 +00:00
|
|
|
return (
|
2021-07-25 22:41:54 +00:00
|
|
|
<div css={tw`flex items-center`}>
|
|
|
|
<TableCheckbox
|
|
|
|
type={'checkbox'}
|
|
|
|
name={'selectedItems'}
|
|
|
|
value={name}
|
|
|
|
checked={checked}
|
|
|
|
onChange={onChange}
|
|
|
|
/>
|
|
|
|
</div>
|
2021-01-01 00:27:16 +00:00
|
|
|
);
|
|
|
|
};
|