|
@ -5,6 +5,8 @@ import styled from 'styled-components' |
|
|
import { space, fontSize, fontWeight, color } from 'styled-system' |
|
|
import { space, fontSize, fontWeight, color } from 'styled-system' |
|
|
import noop from 'lodash/noop' |
|
|
import noop from 'lodash/noop' |
|
|
|
|
|
|
|
|
|
|
|
import { darken, lighten } from 'styles/helpers' |
|
|
|
|
|
|
|
|
import Box from 'components/base/Box' |
|
|
import Box from 'components/base/Box' |
|
|
import Icon from 'components/base/Icon' |
|
|
import Icon from 'components/base/Icon' |
|
|
|
|
|
|
|
@ -14,11 +16,19 @@ const Base = styled.button` |
|
|
${fontSize}; |
|
|
${fontSize}; |
|
|
${fontWeight}; |
|
|
${fontWeight}; |
|
|
border-radius: 5px; |
|
|
border-radius: 5px; |
|
|
border: ${p => (p.primary ? '' : `1px solid ${p.theme.colors.fog}`)}; |
|
|
border: ${p => |
|
|
|
|
|
p.primary ? 'none' : `2px solid ${p.disabled ? 'transparent' : p.theme.colors.grey}`}; |
|
|
cursor: ${p => (p.disabled ? 'default' : 'pointer')}; |
|
|
cursor: ${p => (p.disabled ? 'default' : 'pointer')}; |
|
|
height: 40px; |
|
|
height: 40px; |
|
|
box-shadow: ${p => (p.withShadow ? 'rgba(0, 0, 0, 0.2) 0 3px 10px' : '')}; |
|
|
|
|
|
outline: none; |
|
|
outline: none; |
|
|
|
|
|
|
|
|
|
|
|
&:hover { |
|
|
|
|
|
background: ${p => (p.primary ? lighten(p.theme.colors.wallet, 0.05) : '')}; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
&:active { |
|
|
|
|
|
background: ${p => (p.primary ? darken(p.theme.colors.wallet, 0.1) : '')}; |
|
|
|
|
|
} |
|
|
` |
|
|
` |
|
|
|
|
|
|
|
|
type Props = { |
|
|
type Props = { |
|
@ -33,6 +43,7 @@ function getProps({ disabled, icon, primary }: Object) { |
|
|
const props = (predicate, props, defaults = {}) => (predicate ? props : defaults) |
|
|
const props = (predicate, props, defaults = {}) => (predicate ? props : defaults) |
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
|
|
|
|
color: 'grey', |
|
|
...props( |
|
|
...props( |
|
|
icon, |
|
|
icon, |
|
|
{ |
|
|
{ |
|
@ -49,7 +60,6 @@ function getProps({ disabled, icon, primary }: Object) { |
|
|
{ |
|
|
{ |
|
|
color: 'white', |
|
|
color: 'white', |
|
|
bg: 'wallet', |
|
|
bg: 'wallet', |
|
|
withShadow: true, |
|
|
|
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
bg: 'transparent', |
|
|
bg: 'transparent', |
|
@ -58,12 +68,13 @@ function getProps({ disabled, icon, primary }: Object) { |
|
|
...props(disabled, { |
|
|
...props(disabled, { |
|
|
color: 'white', |
|
|
color: 'white', |
|
|
bg: 'fog', |
|
|
bg: 'fog', |
|
|
withShadow: false, |
|
|
|
|
|
}), |
|
|
}), |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const Button = ({ children, onClick, primary, icon, disabled, ...props }: Props) => { |
|
|
const Button = (props: Props) => { |
|
|
|
|
|
const { onClick, primary, icon, disabled } = props |
|
|
|
|
|
let { children } = props |
|
|
children = icon ? ( |
|
|
children = icon ? ( |
|
|
<Box alignItems="center" justifyContent="center"> |
|
|
<Box alignItems="center" justifyContent="center"> |
|
|
<Icon name={icon} /> |
|
|
<Icon name={icon} /> |
|
|