Improve transaction form UI

Add category buttons for quicker selection.
Change save button color to neuro-income.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-15 03:03:54 +00:00
parent 1ce5e3927c
commit 7e10140b2e

View File

@@ -8,7 +8,7 @@ import { Form, FormField, FormItem, FormLabel, FormControl } from './ui/form';
import { Input } from './ui/input';
import { Button } from './ui/button';
import { useForm } from 'react-hook-form';
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from './ui/select';
import { ToggleGroup, ToggleGroupItem } from './ui/toggle-group';
interface ExpenseFormValues {
title: string;
@@ -92,23 +92,26 @@ const AddTransactionButton = () => {
render={({ field }) => (
<FormItem>
<FormLabel></FormLabel>
<Select
onValueChange={field.onChange}
defaultValue={field.value}
>
<FormControl>
<SelectTrigger>
<SelectValue placeholder="카테고리 선택" />
</SelectTrigger>
</FormControl>
<SelectContent>
<ToggleGroup
type="single"
className="justify-start flex-wrap gap-2"
value={field.value}
onValueChange={(value) => {
if (value) field.onChange(value);
}}
>
{EXPENSE_CATEGORIES.map((category) => (
<SelectItem key={category} value={category}>
<ToggleGroupItem
key={category}
value={category}
className="px-4 py-2 rounded-md border"
>
{category}
</SelectItem>
</ToggleGroupItem>
))}
</SelectContent>
</Select>
</ToggleGroup>
</FormControl>
</FormItem>
)}
/>
@@ -121,7 +124,12 @@ const AddTransactionButton = () => {
>
</Button>
<Button type="submit"></Button>
<Button
type="submit"
className="bg-neuro-income text-white hover:bg-neuro-income/90"
>
</Button>
</div>
</form>
</Form>