diff options
author | Steve Klebanoff <steve@0xproject.com> | 2018-12-18 07:24:30 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-18 07:24:30 +0800 |
commit | 8925317c95927111b48d29d15e44de19db432052 (patch) | |
tree | 530bb9824a29b346e645277d82d5edb294112068 /packages/website/ts/@next/pages/instant/select.tsx | |
parent | 4626921bb6deb3ec9a9768ba9afb01dd690292ec (diff) | |
parent | 6e0d622a1559937d8867216d571156564c666c77 (diff) | |
download | dexon-sol-tools-8925317c95927111b48d29d15e44de19db432052.tar.gz dexon-sol-tools-8925317c95927111b48d29d15e44de19db432052.tar.zst dexon-sol-tools-8925317c95927111b48d29d15e44de19db432052.zip |
Merge pull request #1444 from 0xProject/feature/website/0x-org-instant-config
[website] 0x.org Instant
Diffstat (limited to 'packages/website/ts/@next/pages/instant/select.tsx')
-rw-r--r-- | packages/website/ts/@next/pages/instant/select.tsx | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/packages/website/ts/@next/pages/instant/select.tsx b/packages/website/ts/@next/pages/instant/select.tsx index 422818f9f..f5b5e60c8 100644 --- a/packages/website/ts/@next/pages/instant/select.tsx +++ b/packages/website/ts/@next/pages/instant/select.tsx @@ -12,23 +12,43 @@ 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> - {items.map((item, index) => <option key={`${id}-item-${index}`} value={item.value} selected={item.value === value} onClick={item.onClick}>{item.label}</option>)} + {includeEmpty && <option value="">{emptyText}</option>} + {items.map((item, index) => ( + <option + key={`${id}-item-${index}`} + value={item.value} + selected={item.value === value} + onClick={item.onClick} + > + {item.label} + </option> + ))} </StyledSelect> - <Caret width="12" height="7" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M11 1L6 6 1 1" stroke="#666" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></Caret> + <Caret width="12" height="7" fill="none" xmlns="http://www.w3.org/2000/svg"> + <path d="M11 1L6 6 1 1" stroke="#666" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" /> + </Caret> </Container> ); }; Select.defaultProps = { emptyText: 'Select...', + includeEmpty: true, }; const Container = styled.div` |