diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-12-18 05:01:15 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-12-18 05:01:15 +0800 |
commit | d32f77ebb93a904ee33a43db9207c20c889b0d8f (patch) | |
tree | d230eeda84311674e0ee2da6fee91ff2269c0e5e /packages/website/ts/@next/pages/instant/select.tsx | |
parent | 35cb769456d6b94c768b6ce3afd9535918aea0a1 (diff) | |
download | dexon-sol-tools-d32f77ebb93a904ee33a43db9207c20c889b0d8f.tar dexon-sol-tools-d32f77ebb93a904ee33a43db9207c20c889b0d8f.tar.gz dexon-sol-tools-d32f77ebb93a904ee33a43db9207c20c889b0d8f.tar.bz2 dexon-sol-tools-d32f77ebb93a904ee33a43db9207c20c889b0d8f.tar.lz dexon-sol-tools-d32f77ebb93a904ee33a43db9207c20c889b0d8f.tar.xz dexon-sol-tools-d32f77ebb93a904ee33a43db9207c20c889b0d8f.tar.zst dexon-sol-tools-d32f77ebb93a904ee33a43db9207c20c889b0d8f.zip |
Add includeEmpty option
Diffstat (limited to 'packages/website/ts/@next/pages/instant/select.tsx')
-rw-r--r-- | packages/website/ts/@next/pages/instant/select.tsx | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/packages/website/ts/@next/pages/instant/select.tsx b/packages/website/ts/@next/pages/instant/select.tsx index 1e428c9a1..f5b5e60c8 100644 --- a/packages/website/ts/@next/pages/instant/select.tsx +++ b/packages/website/ts/@next/pages/instant/select.tsx @@ -12,14 +12,22 @@ interface SelectProps { id: string; items: SelectItemConfig[]; emptyText?: string; - onChange?: () => void; + onChange?: (ev: React.ChangeEvent<HTMLSelectElement>) => void; + includeEmpty: boolean; } -export const Select: React.FunctionComponent<SelectProps> = ({ value, id, items, emptyText, onChange }) => { +export const Select: React.FunctionComponent<SelectProps> = ({ + value, + id, + items, + includeEmpty, + emptyText, + onChange, +}) => { return ( <Container> <StyledSelect id={id} onChange={onChange}> - <option value="">{emptyText}</option> + {includeEmpty && <option value="">{emptyText}</option>} {items.map((item, index) => ( <option key={`${id}-item-${index}`} @@ -40,6 +48,7 @@ export const Select: React.FunctionComponent<SelectProps> = ({ value, id, items, Select.defaultProps = { emptyText: 'Select...', + includeEmpty: true, }; const Container = styled.div` |