aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/@next/pages/instant/select.tsx
diff options
context:
space:
mode:
authorSteve Klebanoff <steve@0xproject.com>2018-12-18 07:24:30 +0800
committerGitHub <noreply@github.com>2018-12-18 07:24:30 +0800
commit8925317c95927111b48d29d15e44de19db432052 (patch)
tree530bb9824a29b346e645277d82d5edb294112068 /packages/website/ts/@next/pages/instant/select.tsx
parent4626921bb6deb3ec9a9768ba9afb01dd690292ec (diff)
parent6e0d622a1559937d8867216d571156564c666c77 (diff)
downloaddexon-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.tsx30
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`