File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ export default function Dropdown(props: DropdownProps) {
1111
1212 useEffect ( ( ) => {
1313 if ( props . doNotUseTextArray ) {
14- setDropdownCaptions ( props . options ) ;
14+ setDropdownCaptions ( props . options ?? [ ] ) ;
1515 } else {
1616 setDropdownCaptions ( getTextArray ( props . options ) ) ;
1717 }
@@ -54,7 +54,7 @@ export default function Dropdown(props: DropdownProps) {
5454 "block px-4 py-2 text-sm cursor-pointer"
5555 ) }
5656 onClick = { ( ) => {
57- props . selectedOption ( option ) ;
57+ if ( props . selectedOption ) props . selectedOption ( option ) ;
5858 } }
5959 >
6060 { props . doNotUseTextArray ? option . name : option }
Original file line number Diff line number Diff line change 11/**
22 * Optionset for kern dropdown
3- * @options {string[] | any[]} - Can be any array of strings or objects
43 * @buttonName {string} - The name of the button
4+ * @options {string[] | any[]} - Can be any array of strings or objects
55 * @selectedOption {function} - The function that will be called when an option is selected
66 * @disabled {DropdownOptionsProps} - If the dropdown is disabled
77 * @onlyArray {boolean} - If the dropdown has only an array of strings
1212 * @doNotUseTextArray {boolean} - If the dropdown should not use the text array
1313*/
1414export type DropdownProps = {
15+ buttonName : string ;
1516 options ?: string [ ] | any [ ] ;
16- buttonName ?: string ;
17- selectedOption ?: ( event : any ) => void ;
17+ selectedOption ?: ( value : any ) => void ;
1818 disabled ?: boolean ;
1919 onlyArray ?: boolean ;
2020 dropdownClasses ?: string ;
You can’t perform that action at this time.
0 commit comments