Skip to content

Commit 49d2896

Browse files
committed
Improve UI for filters
1 parent 9d649da commit 49d2896

8 files changed

Lines changed: 21 additions & 13 deletions

File tree

web/components/comments/dropdown-menu.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export type DropdownItem = {
1010
onClick: () => void | Promise<void>
1111
}
1212

13-
// NOTE: you can't conditionally render any of the items from a useEffect hook, or you'll get hydration errors
1413
export default function DropdownMenu(props: {
1514
items: DropdownItem[]
1615
icon?: ReactNode
@@ -90,7 +89,7 @@ export default function DropdownMenu(props: {
9089
className={clsx(
9190
selectedItemName && item.name == selectedItemName
9291
? 'bg-primary-100'
93-
: 'hover:bg-canvas-100 hover:text-ink-900',
92+
: 'hover:bg-canvas-200 hover:text-ink-900',
9493
'text-ink-700',
9594
'flex w-full gap-2 px-4 py-2 text-left text-sm'
9695
)}

web/components/filters/desktop-filters.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,11 @@ export function DesktopFilters(props: {
465465
/>
466466
)}
467467
dropdownMenuContent={
468-
<ReligionFilter filters={filters} updateFilter={updateFilter}/>
468+
<ReligionFilter
469+
filters={filters}
470+
updateFilter={updateFilter}
471+
className={'w-[350px] grid grid-cols-2'}
472+
/>
469473
}
470474
popoverClassName="bg-canvas-50"
471475
menuWidth="w-50"
@@ -491,7 +495,7 @@ export function DesktopFilters(props: {
491495
<MbtiFilter filters={filters} updateFilter={updateFilter} />
492496
}
493497
popoverClassName="bg-canvas-50"
494-
menuWidth="w-[350px]"
498+
menuWidth="w-[350px] grid-cols-2"
495499
/>
496500

497501
{/* SMOKER */}

web/components/filters/mbti-filter.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export function MbtiFilter(props: {
5151

5252
return (
5353
<MultiCheckbox
54+
className={'grid grid-cols-2 xs:grid-cols-4'}
5455
selected={filters.mbti ?? []}
5556
choices={MBTI_CHOICES as any}
5657
onChange={(c) => {

web/components/filters/religion-filter.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ export function ReligionFilterText(props: {
4949
export function ReligionFilter(props: {
5050
filters: Partial<FilterFields>
5151
updateFilter: (newState: Partial<FilterFields>) => void
52+
className?: string
5253
}) {
53-
const {filters, updateFilter} = props
54+
const {filters, updateFilter, className} = props
5455
return (
5556
<>
5657
<MultiCheckbox
@@ -59,6 +60,7 @@ export function ReligionFilter(props: {
5960
onChange={(c) => {
6061
updateFilter({religion: c})
6162
}}
63+
className={className}
6264
/>
6365
</>
6466
)

web/components/multi-checkbox.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import { Row } from 'web/components/layout/row'
22
import { Checkbox } from 'web/components/widgets/checkbox'
3+
import clsx from "clsx";
34

45
export const MultiCheckbox = (props: {
56
choices: { [key: string]: string }
67
selected: string[]
78
onChange: (selected: string[]) => void
9+
className?: string
810
}) => {
9-
const { choices, selected, onChange } = props
11+
const { choices, selected, onChange, className } = props
1012
return (
11-
<Row className={'flex-wrap gap-3'}>
13+
<Row className={clsx('flex-wrap', className)}>
1214
{Object.entries(choices).map(([key, value]) => (
1315
<Checkbox
1416
key={key}

web/components/profile-about.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ export default function ProfileAbout(props: {
9898
text={profile.religion?.map(belief => INVERTED_RELIGION_CHOICES[belief])}
9999
suffix={profile.religious_beliefs}
100100
/>
101+
<AboutRow
102+
icon={<BsPersonVcard className="h-5 w-5"/>}
103+
text={profile.mbti ? INVERTED_MBTI_CHOICES[profile.mbti] : null}
104+
/>
101105
<AboutRow
102106
icon={<HiOutlineGlobe className="h-5 w-5"/>}
103107
text={profile.ethnicity
@@ -110,10 +114,6 @@ export default function ProfileAbout(props: {
110114
icon={<GiFruitBowl className="h-5 w-5"/>}
111115
text={profile.diet?.map(e => INVERTED_DIET_CHOICES[e])}
112116
/>
113-
<AboutRow
114-
icon={<BsPersonVcard className="h-5 w-5"/>}
115-
text={profile.mbti ? INVERTED_MBTI_CHOICES[profile.mbti] : null}
116-
/>
117117
<HasKids profile={profile}/>
118118
<WantsKids profile={profile}/>
119119
{!isCurrentUser && <LastOnline lastOnlineTime={userActivity?.last_online_time}/>}

web/components/widgets/checkbox.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export function Checkbox(props: {
1010
const { label, checked, toggle, className, disabled } = props
1111

1212
return (
13-
<div className={clsx(className, 'space-y-5')}>
13+
<div className={clsx(className, 'space-y-5 px-2 py-1 hover:bg-canvas-200 hover:rounded')}>
1414
<div className="relative flex items-center">
1515
<div className="flex h-6 items-center">
1616
<input

web/components/widgets/customizeable-dropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export function CustomizeableDropdown(props: {
5454
style={styles.popper}
5555
{...attributes.popper}
5656
className={clsx(
57-
'bg-canvas-0 ring-ink-1000 z-30 rounded-md px-4 py-2 shadow-lg ring-1 ring-opacity-5 focus:outline-none',
57+
'bg-canvas-0 ring-ink-1000 z-30 rounded-md px-2 py-2 shadow-lg ring-1 ring-opacity-5 focus:outline-none',
5858
menuWidth ?? 'w-36',
5959
popoverClassName
6060
)}

0 commit comments

Comments
 (0)