Skip to content

Commit 15b19ba

Browse files
authored
Improve category picker layout (#472)
* Improve category picker layout * Remove extra 'general' subcategory from 'general' category.
1 parent 8deace7 commit 15b19ba

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/components/AddExpense/CategoryPicker.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const CategoryPicker: React.FC<{
2828
<h3 className="mb-4 text-lg font-semibold">
2929
{t(`categories_list.${categoryName}.name`)}
3030
</h3>
31-
<div className="flex flex-wrap justify-between gap-2">
31+
<div className="grid grid-cols-[repeat(auto-fill,minmax(75px,1fr))] gap-4">
3232
{categoryItems.map((key: string) => {
3333
const handleClick = useMemo(
3434
() => () => {
@@ -41,15 +41,15 @@ export const CategoryPicker: React.FC<{
4141
<DrawerClose key={key}>
4242
<Button
4343
variant="ghost"
44-
className="flex w-[75px] flex-col gap-1 py-8 text-center"
44+
className="flex h-[75px] w-[75px] flex-col items-center justify-start gap-1 justify-self-center py-3 text-center"
4545
onClick={handleClick}
4646
>
47-
<span className="block text-2xl">
47+
<span className="block flex-shrink-0 text-2xl">
4848
<CategoryIcon
4949
category={(key === 'other' ? categoryName : key) as CategoryItem}
5050
/>
5151
</span>
52-
<span className="block text-xs capitalize">
52+
<span className="block text-xs text-wrap">
5353
{t(`categories_list.${categoryName}.items.${key}`, { ns: 'categories' })}
5454
</span>
5555
</Button>

src/lib/category.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const CATEGORIES = {
1515
life: ['childcare', 'clothing', 'education', 'gifts', 'insurance', 'medical', 'taxes', 'other'],
1616
travel: ['bicycle', 'bus', 'train', 'car', 'fuel', 'hotel', 'parking', 'plane', 'taxi', 'other'],
1717
utilities: ['cleaning', 'electricity', 'gas', 'internet', 'trash', 'phone', 'water', 'other'],
18-
general: ['general', 'other'],
18+
general: ['other'],
1919
} as const satisfies Record<string, string[]>;
2020

2121
export const DEFAULT_CATEGORY = 'general';

0 commit comments

Comments
 (0)