Move select all button to top of category selector modal

This commit is contained in:
James Grugett 2022-06-06 10:44:36 -05:00
parent 43b0fe6749
commit 773465c6c5

View File

@ -119,6 +119,22 @@ function CategorySelectorModal(props: {
return ( return (
<Modal open={isOpen} setOpen={setIsOpen}> <Modal open={isOpen} setOpen={setIsOpen}>
<Col className="rounded bg-white p-6"> <Col className="rounded bg-white p-6">
<button
className="btn btn-sm btn-ghost mb-3 self-start"
onClick={() => {
if (selectAll) {
updateUser(user.id, {
followedCategories: CATEGORY_LIST,
})
} else {
updateUser(user.id, {
followedCategories: [],
})
}
}}
>
Select {selectAll ? 'all' : 'none'}
</button>
<Col className="grid w-full grid-cols-2 gap-4"> <Col className="grid w-full grid-cols-2 gap-4">
{CATEGORY_LIST.map((cat) => ( {CATEGORY_LIST.map((cat) => (
<Checkbox <Checkbox
@ -136,22 +152,6 @@ function CategorySelectorModal(props: {
/> />
))} ))}
</Col> </Col>
<button
className="btn btn-sm btn-ghost mt-2 self-end"
onClick={() => {
if (selectAll) {
updateUser(user.id, {
followedCategories: CATEGORY_LIST,
})
} else {
updateUser(user.id, {
followedCategories: [],
})
}
}}
>
Select {selectAll ? 'all' : 'none'}
</button>
</Col> </Col>
</Modal> </Modal>
) )