Files
twenty/front/src/modules/ui/data-table/components/SelectAllCheckbox.tsx
Thaïs 7af306792b feat: add Table and TableSection components (#1849)
* refactor: rename ui/table to ui/data-table

* feat: add Table and TableSection components

Closes #1806
2023-10-04 17:46:14 +02:00

36 lines
745 B
TypeScript

import styled from '@emotion/styled';
import { Checkbox } from '@/ui/input/components/Checkbox';
import { useSelectAllRows } from '../hooks/useSelectAllRows';
const StyledContainer = styled.div`
align-items: center;
display: flex;
height: 32px;
justify-content: center;
`;
export const SelectAllCheckbox = () => {
const { selectAllRows, allRowsSelectedStatus } = useSelectAllRows();
const checked = allRowsSelectedStatus === 'all';
const indeterminate = allRowsSelectedStatus === 'some';
const onChange = () => {
selectAllRows();
};
return (
<StyledContainer>
<Checkbox
checked={checked}
onChange={onChange}
indeterminate={indeterminate}
/>
</StyledContainer>
);
};