@@ -2,9 +2,9 @@ import React from 'react'
22import PropTypes from 'prop-types'
33import classNames from 'classnames'
44import styled from 'styled-components'
5- import { darken } from 'polished'
65import handleRef from './internal/handleRef'
7- import defaultTheme from './style/defaultTheme'
6+ import * as defaultTheme from './style/defaultTheme'
7+ import { th } from './utils'
88
99const ButtonComponent = ( { className, size, ...props } ) => (
1010 < button
@@ -21,40 +21,40 @@ const ButtonComponent = ({ className, size, ...props }) => (
2121
2222const Button = styled ( handleRef ( ButtonComponent ) ) `
2323 display: inline-block;
24- padding: ${ props => props . theme . textControlPadding . sm } ;
25- z-index: ${ props => props . theme . zIndexes . control } ;
26- border-radius: ${ props => props . theme . borderRadius . md } ;
27- font-size: 1rem ;
28- line-height: 1.5 ;
29- background-color: ${ props => props . theme . colors . primary } ;
30- color: ${ props => props . theme . colors . white } ;
31- border: 0 ;
24+ padding: ${ th ( 'btnPaddingY' ) } ${ th ( 'btnPaddingX' ) } ;
25+ z-index: ${ th ( 'zIndexControl' ) } ;
26+ border-radius: ${ th ( ' borderRadius' ) } ;
27+ font-size: ${ th ( 'fontSizeBase' ) } ;
28+ line-height: ${ th ( 'lineHeightBase' ) } ;
29+ background-color: ${ th ( 'btnBackgroundColor' ) } ;
30+ color: ${ th ( ' white' ) } ;
31+ border-width: ${ th ( 'btnBorderWidth' ) } ;
3232 cursor: pointer;
33- transition: background-color 300ms ;
33+ transition: ${ th ( 'transitionBase' ) } ;
3434
3535 &:focus {
36- ${ props => props . theme . mixins . controlFocus } ;
36+ ${ th ( ' controlFocus' ) } ;
3737 }
3838
3939 &:not(:disabled):hover,
4040 &:not(:disabled):active {
41- background-color: ${ props => darken ( 0.05 , props . theme . colors . primary ) } ;
41+ background-color: ${ th ( 'btnHoverBackgroundColor' ) } ;
4242 }
4343
44- &.sui-button-lg {
45- padding: ${ props => props . theme . textControlPadding . lg } ;
46- font-size: ${ props => props . theme . controlFontSize . lg } ;
47- border-radius: ${ props => props . theme . borderRadius . lg } ;
44+ &.sui-button-sm {
45+ padding: ${ th ( 'btnPaddingYSm' ) } ${ th ( 'btnPaddingXSm' ) } ;
46+ font-size: ${ th ( 'fontSizeSm' ) } ;
47+ border-radius: ${ th ( 'borderRadiusSm' ) } ;
4848 }
4949
50- &.sui-button-sm {
51- padding: ${ props => props . theme . textControlPadding . sm } ;
52- font-size: ${ props => props . theme . controlFontSize . sm } ;
53- border-radius: ${ props => props . theme . borderRadius . sm } ;
50+ &.sui-button-lg {
51+ padding: ${ th ( 'btnPaddingYLg' ) } ${ th ( 'btnPaddingXLg' ) } ;
52+ font-size: ${ th ( 'fontSizeLg' ) } ;
53+ border-radius: ${ th ( 'borderRadiusLg' ) } ;
5454 }
5555
5656 &:disabled {
57- opacity: 0.8 ;
57+ opacity: ${ th ( 'btnDisabledOpacity' ) } ;
5858 }
5959`
6060
0 commit comments