diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-10-05 08:47:32 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-10-05 08:48:10 +0800 |
commit | 98f8c7749433e63d7fea3c4e932db1f251607e4d (patch) | |
tree | 7118d4d967079a1768539ae19d35b30f6ab42c26 /packages/instant/src/components/ui | |
parent | d9b7aa2e4ba088b4dda1b1d2956de5d267a0674e (diff) | |
download | dexon-sol-tools-98f8c7749433e63d7fea3c4e932db1f251607e4d.tar.gz dexon-sol-tools-98f8c7749433e63d7fea3c4e932db1f251607e4d.tar.zst dexon-sol-tools-98f8c7749433e63d7fea3c4e932db1f251607e4d.zip |
Add BuyButton and other small improvement
Diffstat (limited to 'packages/instant/src/components/ui')
-rw-r--r-- | packages/instant/src/components/ui/button.tsx | 26 | ||||
-rw-r--r-- | packages/instant/src/components/ui/container.tsx | 2 |
2 files changed, 11 insertions, 17 deletions
diff --git a/packages/instant/src/components/ui/button.tsx b/packages/instant/src/components/ui/button.tsx index ec0a87345..1fcb2591c 100644 --- a/packages/instant/src/components/ui/button.tsx +++ b/packages/instant/src/components/ui/button.tsx @@ -4,11 +4,8 @@ import * as React from 'react'; import { ColorOption, styled } from '../../style/theme'; export interface ButtonProps { - fontColor: ColorOption; - backgroundColor: ColorOption; + backgroundColor?: ColorOption; borderColor?: ColorOption; - fontSize?: string; - fontFamily?: string; width?: string; padding?: string; type?: string; @@ -28,41 +25,36 @@ const darkenOnActiveAmount = 0.2; const saturateOnFocusAmount = 0.2; export const Button = styled(PlainButton)` cursor: ${props => (props.isDisabled ? 'default' : 'pointer')}; - font-size: ${props => props.fontSize}; - color: ${props => props.fontColor}; transition: background-color, opacity 0.5s ease; padding: ${props => props.padding}; - border-radius: 6px; - font-weight: 500; + border-radius: 3px; outline: none; - font-family: ${props => props.fontFamily}; width: ${props => props.width}; - background-color: ${props => props.backgroundColor}; + 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]) : ''} !important; + !props.isDisabled + ? darken(darkenOnHoverAmount, props.theme[props.backgroundColor || 'white']) + : ''} !important; } &:active { background-color: ${props => - !props.isDisabled ? darken(darkenOnActiveAmount, props.theme[props.backgroundColor]) : ''}; + !props.isDisabled ? darken(darkenOnActiveAmount, props.theme[props.backgroundColor || 'white']) : ''}; } &:disabled { opacity: 0.5; } &:focus { - background-color: ${props => saturate(saturateOnFocusAmount, props.theme[props.backgroundColor])}; + background-color: ${props => saturate(saturateOnFocusAmount, props.theme[props.backgroundColor || 'white'])}; } `; Button.defaultProps = { - fontSize: '12px', - fontColor: ColorOption.white, backgroundColor: ColorOption.primaryColor, width: 'auto', - fontFamily: 'Inter UI', isDisabled: false, - padding: '0.8em 2.2em', + padding: '1em 2.2em', }; Button.displayName = 'Button'; diff --git a/packages/instant/src/components/ui/container.tsx b/packages/instant/src/components/ui/container.tsx index 4ebaf2af3..bc47ba0aa 100644 --- a/packages/instant/src/components/ui/container.tsx +++ b/packages/instant/src/components/ui/container.tsx @@ -25,6 +25,7 @@ export interface ContainerProps { borderTop?: string; className?: string; backgroundColor?: ColorOption; + hasBoxShadow?: boolean; } const PlainContainer: React.StatelessComponent<ContainerProps> = ({ children, className }) => ( @@ -50,6 +51,7 @@ export const Container = styled(PlainContainer)` ${props => cssRuleIfExists(props, 'border-radius')} ${props => cssRuleIfExists(props, 'border')} ${props => cssRuleIfExists(props, 'border-top')} + ${props => (props.hasBoxShadow ? `box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.1)` : '')}; background-color: ${props => (props.backgroundColor ? props.theme[props.backgroundColor] : 'none')}; border-color: ${props => (props.borderColor ? props.theme[props.borderColor] : 'none')}; `; |