feat: 💨
This commit is contained in:
@@ -88,16 +88,17 @@ export default function KindFilter({
|
|||||||
const content = (
|
const content = (
|
||||||
<div>
|
<div>
|
||||||
<div className="grid grid-cols-2 gap-2">
|
<div className="grid grid-cols-2 gap-2">
|
||||||
{SUPPORTED_KINDS.map(({ kindGroup, label }) => (
|
{SUPPORTED_KINDS.map(({ kindGroup, label }) => {
|
||||||
<Label
|
const checked = kindGroup.every((k) => temporaryShowKinds.includes(k))
|
||||||
key={label}
|
return (
|
||||||
className="focus:bg-accent/50 cursor-pointer flex items-start gap-3 rounded-lg border px-4 py-3 has-[[aria-checked=true]]:border-primary has-[[aria-checked=true]]:bg-primary/20"
|
<div
|
||||||
>
|
key={label}
|
||||||
<Checkbox
|
className={cn(
|
||||||
id="toggle-2"
|
'cursor-pointer grid gap-1.5 rounded-lg border px-4 py-3',
|
||||||
checked={kindGroup.every((k) => temporaryShowKinds.includes(k))}
|
checked ? 'border-primary bg-primary/20' : 'clickable'
|
||||||
onCheckedChange={(checked) => {
|
)}
|
||||||
if (checked) {
|
onClick={() => {
|
||||||
|
if (!checked) {
|
||||||
// add all kinds in this group
|
// add all kinds in this group
|
||||||
setTemporaryShowKinds((prev) => Array.from(new Set([...prev, ...kindGroup])))
|
setTemporaryShowKinds((prev) => Array.from(new Set([...prev, ...kindGroup])))
|
||||||
} else {
|
} else {
|
||||||
@@ -105,13 +106,12 @@ export default function KindFilter({
|
|||||||
setTemporaryShowKinds((prev) => prev.filter((k) => !kindGroup.includes(k)))
|
setTemporaryShowKinds((prev) => prev.filter((k) => !kindGroup.includes(k)))
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
>
|
||||||
<div className="grid gap-1.5">
|
|
||||||
<p className="leading-none font-medium">{t(label)}</p>
|
<p className="leading-none font-medium">{t(label)}</p>
|
||||||
<p className="text-muted-foreground text-xs">kind {kindGroup.join(', ')}</p>
|
<p className="text-muted-foreground text-xs">kind {kindGroup.join(', ')}</p>
|
||||||
</div>
|
</div>
|
||||||
</Label>
|
)
|
||||||
))}
|
})}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex gap-2 mt-4">
|
<div className="flex gap-2 mt-4">
|
||||||
|
|||||||
Reference in New Issue
Block a user