Match design for filters

This commit is contained in:
Nicolas Mowen 2024-03-28 07:44:30 -06:00
parent 7b8c5f4118
commit 60ed76a4ba
2 changed files with 53 additions and 41 deletions

View File

@ -515,7 +515,7 @@ function GeneralFilterButton({
}} }}
> >
<PopoverTrigger asChild>{trigger}</PopoverTrigger> <PopoverTrigger asChild>{trigger}</PopoverTrigger>
<PopoverContent side="left">{content}</PopoverContent> <PopoverContent>{content}</PopoverContent>
</Popover> </Popover>
); );
} }
@ -538,35 +538,52 @@ export function GeneralFilterContent({
}: GeneralFilterContentProps) { }: GeneralFilterContentProps) {
return ( return (
<> <>
<DropdownMenuSeparator />
<DropdownMenuLabel className="flex justify-center items-center">
Filter Labels
</DropdownMenuLabel>
<DropdownMenuSeparator />
<div className="h-auto overflow-y-auto overflow-x-hidden"> <div className="h-auto overflow-y-auto overflow-x-hidden">
<FilterCheckBox <div className="flex justify-between items-center my-2.5">
isChecked={currentLabels == undefined} <Label
label="All Labels" className="mx-2 text-secondary-foreground cursor-pointer"
htmlFor="allLabels"
>
All Labels
</Label>
<Switch
className="ml-1"
id="allLabels"
checked={currentLabels == undefined}
onCheckedChange={(isChecked) => { onCheckedChange={(isChecked) => {
if (isChecked) { if (isChecked) {
setCurrentLabels(undefined); setCurrentLabels(undefined);
} }
}} }}
/> />
</div>
<DropdownMenuSeparator /> <DropdownMenuSeparator />
<div className="my-2.5 flex flex-col gap-2.5">
{allLabels.map((item) => ( {allLabels.map((item) => (
<FilterCheckBox <div className="flex justify-between items-center">
<Label
className="w-full mx-2 text-secondary-foreground capitalize cursor-pointer"
htmlFor={item}
>
{item.replaceAll("_", " ")}
</Label>
<Switch
key={item} key={item}
isChecked={currentLabels?.includes(item) ?? false} className="ml-1"
label={item.replaceAll("_", " ")} id={item}
checked={currentLabels?.includes(item) ?? false}
onCheckedChange={(isChecked) => { onCheckedChange={(isChecked) => {
if (isChecked) { if (isChecked) {
const updatedLabels = currentLabels ? [...currentLabels] : []; const updatedLabels = currentLabels
? [...currentLabels]
: [];
updatedLabels.push(item); updatedLabels.push(item);
setCurrentLabels(updatedLabels); setCurrentLabels(updatedLabels);
} else { } else {
const updatedLabels = currentLabels ? [...currentLabels] : []; const updatedLabels = currentLabels
? [...currentLabels]
: [];
// can not deselect the last item // can not deselect the last item
if (updatedLabels.length > 1) { if (updatedLabels.length > 1) {
@ -576,8 +593,10 @@ export function GeneralFilterContent({
} }
}} }}
/> />
</div>
))} ))}
</div> </div>
</div>
<DropdownMenuSeparator /> <DropdownMenuSeparator />
<div className="p-2 flex justify-evenly items-center"> <div className="p-2 flex justify-evenly items-center">
<Button <Button

View File

@ -292,10 +292,3 @@ export default function MobileReviewSettingsDrawer({
</> </>
); );
} }
/**
* <MobileTimelineDrawer
selected={timelineType ?? "timeline"}
onSelect={setTimelineType}
/>
*/