File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
apps/portal/src/components/shared Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -11,9 +11,11 @@ export type MonthYear = Readonly<{
11
11
type Props = Readonly < {
12
12
errorMessage ?: string ;
13
13
monthLabel ?: string ;
14
+ monthRequired ?: boolean ;
14
15
onChange : ( value : MonthYear ) => void ;
15
16
value : MonthYear ;
16
17
yearLabel ?: string ;
18
+ yearRequired ?: boolean ;
17
19
} > ;
18
20
19
21
const MONTH_OPTIONS = [
@@ -82,17 +84,20 @@ export default function MonthYearPicker({
82
84
value,
83
85
onChange,
84
86
yearLabel = 'Year' ,
87
+ monthRequired = false ,
88
+ yearRequired = false ,
85
89
} : Props ) {
86
90
const hasError = errorMessage != null ;
87
91
const errorId = useId ( ) ;
88
92
89
93
return (
90
94
< div
91
95
aria-describedby = { hasError ? errorId : undefined }
92
- className = "flex space-x-4" >
96
+ className = "flex items-end space-x-4" >
93
97
< Select
94
98
label = { monthLabel }
95
99
options = { MONTH_OPTIONS }
100
+ required = { monthRequired }
96
101
value = { value . month }
97
102
onChange = { ( newMonth ) =>
98
103
onChange ( { month : Number ( newMonth ) as Month , year : value . year } )
@@ -101,6 +106,7 @@ export default function MonthYearPicker({
101
106
< Select
102
107
label = { yearLabel }
103
108
options = { YEAR_OPTIONS }
109
+ required = { yearRequired }
104
110
value = { value . year }
105
111
onChange = { ( newYear ) =>
106
112
onChange ( { month : value . month , year : Number ( newYear ) } )
You can’t perform that action at this time.
0 commit comments