diff --git a/apps/portal/src/components/shared/MonthYearPicker.tsx b/apps/portal/src/components/shared/MonthYearPicker.tsx index bf000501..b4657e6d 100644 --- a/apps/portal/src/components/shared/MonthYearPicker.tsx +++ b/apps/portal/src/components/shared/MonthYearPicker.tsx @@ -1,3 +1,4 @@ +import { useId } from 'react'; import { Select } from '@tih/ui'; export type Month = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12; @@ -8,8 +9,11 @@ export type MonthYear = Readonly<{ }>; type Props = Readonly<{ + errorMessage?: string; + monthLabel?: string; onChange: (value: MonthYear) => void; value: MonthYear; + yearLabel?: string; }>; const MONTH_OPTIONS = [ @@ -72,11 +76,22 @@ const YEAR_OPTIONS = Array.from({ length: NUM_YEARS }, (_, i) => { }; }); -export default function MonthYearPicker({ value, onChange }: Props) { +export default function MonthYearPicker({ + errorMessage, + monthLabel = 'Month', + value, + onChange, + yearLabel = 'Year', +}: Props) { + const hasError = errorMessage != null; + const errorId = useId(); + return ( -