diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-11-08 13:38:54 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-11-08 13:38:54 +0800 |
commit | ecb92a44bc5a4b433f2a673fc77199c7b8a6dc18 (patch) | |
tree | b2abb75073906c511854e6ab95be2e8ed5a035b2 /packages/instant/src/components/ui | |
parent | f7642c06f0d5662c955ec36e1549d63445a74056 (diff) | |
download | dexon-sol-tools-ecb92a44bc5a4b433f2a673fc77199c7b8a6dc18.tar dexon-sol-tools-ecb92a44bc5a4b433f2a673fc77199c7b8a6dc18.tar.gz dexon-sol-tools-ecb92a44bc5a4b433f2a673fc77199c7b8a6dc18.tar.bz2 dexon-sol-tools-ecb92a44bc5a4b433f2a673fc77199c7b8a6dc18.tar.lz dexon-sol-tools-ecb92a44bc5a4b433f2a673fc77199c7b8a6dc18.tar.xz dexon-sol-tools-ecb92a44bc5a4b433f2a673fc77199c7b8a6dc18.tar.zst dexon-sol-tools-ecb92a44bc5a4b433f2a673fc77199c7b8a6dc18.zip |
feat: create PaymentMethodDropdown
Diffstat (limited to 'packages/instant/src/components/ui')
-rw-r--r-- | packages/instant/src/components/ui/button.tsx | 62 | ||||
-rw-r--r-- | packages/instant/src/components/ui/dropdown.tsx | 21 | ||||
-rw-r--r-- | packages/instant/src/components/ui/overlay.tsx | 1 |
3 files changed, 46 insertions, 38 deletions
diff --git a/packages/instant/src/components/ui/button.tsx b/packages/instant/src/components/ui/button.tsx index 5274d835b..61a0f23a8 100644 --- a/packages/instant/src/components/ui/button.tsx +++ b/packages/instant/src/components/ui/button.tsx @@ -6,6 +6,8 @@ import { ColorOption, styled } from '../../style/theme'; export interface ButtonProps { backgroundColor?: ColorOption; borderColor?: ColorOption; + fontColor?: ColorOption; + fontSize?: string; width?: string; padding?: string; type?: string; @@ -24,38 +26,50 @@ const darkenOnHoverAmount = 0.1; const darkenOnActiveAmount = 0.2; const saturateOnFocusAmount = 0.2; export const Button = styled(PlainButton)` - cursor: ${props => (props.isDisabled ? 'default' : 'pointer')}; - transition: background-color, opacity 0.5s ease; - padding: ${props => props.padding}; - border-radius: 3px; - outline: none; - width: ${props => props.width}; - background-color: ${props => (props.backgroundColor ? props.theme[props.backgroundColor] : 'none')}; - border: ${props => (props.borderColor ? `1px solid ${props.theme[props.borderColor]}` : 'none')}; - &:hover { - background-color: ${props => - !props.isDisabled - ? darken(darkenOnHoverAmount, props.theme[props.backgroundColor || 'white']) - : ''} !important; - } - &:active { - background-color: ${props => - !props.isDisabled ? darken(darkenOnActiveAmount, props.theme[props.backgroundColor || 'white']) : ''}; - } - &:disabled { - opacity: 0.5; - } - &:focus { - background-color: ${props => saturate(saturateOnFocusAmount, props.theme[props.backgroundColor || 'white'])}; + && { + all: initial; + box-sizing: border-box; + font-size: ${props => props.fontSize}; + font-family: 'Inter UI', sans-serif; + font-weight: 600; + color: ${props => props.fontColor && props.theme[props.fontColor]}; + cursor: ${props => (props.isDisabled ? 'default' : 'pointer')}; + transition: background-color, opacity 0.5s ease; + padding: ${props => props.padding}; + border-radius: 3px; + text-align: center; + outline: none; + width: ${props => props.width}; + background-color: ${props => (props.backgroundColor ? props.theme[props.backgroundColor] : 'none')}; + border: ${props => (props.borderColor ? `1px solid ${props.theme[props.borderColor]}` : 'none')}; + &:hover { + background-color: ${props => + !props.isDisabled + ? darken(darkenOnHoverAmount, props.theme[props.backgroundColor || 'white']) + : ''} !important; + } + &:active { + background-color: ${props => + !props.isDisabled ? darken(darkenOnActiveAmount, props.theme[props.backgroundColor || 'white']) : ''}; + } + &:disabled { + opacity: 0.5; + } + &:focus { + background-color: ${props => + saturate(saturateOnFocusAmount, props.theme[props.backgroundColor || 'white'])}; + } } `; Button.defaultProps = { backgroundColor: ColorOption.primaryColor, borderColor: ColorOption.primaryColor, + fontColor: ColorOption.white, width: 'auto', isDisabled: false, - padding: '1em 2.2em', + padding: '.6em 1.2em', + fontSize: '15px', }; Button.displayName = 'Button'; diff --git a/packages/instant/src/components/ui/dropdown.tsx b/packages/instant/src/components/ui/dropdown.tsx index ae4731b6f..d51060c05 100644 --- a/packages/instant/src/components/ui/dropdown.tsx +++ b/packages/instant/src/components/ui/dropdown.tsx @@ -17,7 +17,7 @@ export interface DropdownItemConfig { export interface DropdownProps { value: string; - label: string; + label?: string; items: DropdownItemConfig[]; } @@ -27,14 +27,7 @@ export interface DropdownState { export class Dropdown extends React.Component<DropdownProps, DropdownState> { public static defaultProps = { - items: [ - { - text: 'Item 1', - }, - { - text: 'Item 2', - }, - ], + items: [], }; public state: DropdownState = { isOpen: false, @@ -57,7 +50,7 @@ export class Dropdown extends React.Component<DropdownProps, DropdownState> { <Container cursor={hasItems ? 'pointer' : undefined} onClick={this._handleDropdownClick} - hasBoxShadow={true} + hasBoxShadow={isOpen} borderRadius={borderRadius} border="1px solid" borderColor={ColorOption.feintGrey} @@ -69,9 +62,11 @@ export class Dropdown extends React.Component<DropdownProps, DropdownState> { {value} </Text> <Container> - <Text fontSize="16px" fontColor={ColorOption.lightGrey}> - {label} - </Text> + {label && ( + <Text fontSize="16px" fontColor={ColorOption.lightGrey}> + {label} + </Text> + )} {hasItems && ( <Container marginLeft="5px" display="inline-block" position="relative" bottom="2px"> <Icon padding="3px" icon="chevron" width={12} stroke={ColorOption.grey} /> diff --git a/packages/instant/src/components/ui/overlay.tsx b/packages/instant/src/components/ui/overlay.tsx index 64090a6b3..7c941d294 100644 --- a/packages/instant/src/components/ui/overlay.tsx +++ b/packages/instant/src/components/ui/overlay.tsx @@ -1,5 +1,4 @@ import * as _ from 'lodash'; -import * as React from 'react'; import { overlayBlack, styled } from '../../style/theme'; import { zIndex } from '../../style/z_index'; |