@@ -70,54 +70,54 @@ const variantStyles = {
7070 } ,
7171} ;
7272
73- export const Button = styled ( Element ) . attrs ( { as : 'button' } ) < {
74- type ?: 'submit' | 'button' | 'reset' ;
73+ interface IButtonProps extends React . ButtonHTMLAttributes < HTMLButtonElement > {
7574 variant ?: 'primary' | 'secondary' | 'link' | 'danger' ;
76- disabled ?: boolean ;
77- onClick ?: any ;
78- } > ( ( { variant = 'primary' , ...props } ) =>
79- css (
80- deepmerge (
81- // @ts -ignore deepmerge allows functions as values
82- // it overrides instead of merging, which is what we want
83- // but it's types don't like it. so we're going to ignore that
84- // TODO: raise a pull request for deepmerge or pick a different
85- // library to deep merge objects
86- variantStyles [ variant ] ,
87- // static styles:
88- {
89- display : 'inline-flex' ,
90- justifyContent : 'center' ,
91- alignItems : 'center' ,
92- flex : 'none' , // as a flex child
93- cursor : 'pointer' ,
94- fontFamily : 'Inter, sans-serif' ,
95- paddingY : 0 ,
96- paddingX : 2 ,
97- height : '26px' , // match with inputs
98- width : '100%' ,
99- fontSize : 2 ,
100- fontWeight : 'medium' ,
101- lineHeight : 1 , // trust the height
102- border : 'none' ,
103- borderRadius : 'small' ,
104- transition : 'all ease-in' ,
105- transitionDuration : theme => theme . speeds [ 2 ] ,
75+ }
10676
107- ':focus' : {
108- outline : 'none' ,
109- } ,
110- ':active' : {
111- transform : 'scale(0.98)' ,
112- } ,
113- ':disabled' : {
114- opacity : '0.4' ,
115- cursor : 'not-allowed' ,
116- } ,
117- ...props . css ,
118- }
77+ export const Button = styled ( Element ) . attrs ( { as : 'button' } ) < IButtonProps > (
78+ ( { variant = 'primary' , ...props } ) =>
79+ css (
80+ deepmerge (
81+ // @ts -ignore deepmerge allows functions as values
82+ // it overrides instead of merging, which is what we want
83+ // but it's types don't like it. so we're going to ignore that
84+ // TODO: raise a pull request for deepmerge or pick a different
85+ // library to deep merge objects
86+ variantStyles [ variant ] ,
87+ // static styles:
88+ {
89+ display : 'inline-flex' ,
90+ justifyContent : 'center' ,
91+ alignItems : 'center' ,
92+ flex : 'none' , // as a flex child
93+ cursor : 'pointer' ,
94+ fontFamily : 'Inter, sans-serif' ,
95+ paddingY : 0 ,
96+ paddingX : 2 ,
97+ height : '26px' , // match with inputs
98+ width : '100%' ,
99+ fontSize : 2 ,
100+ fontWeight : 'medium' ,
101+ lineHeight : 1 , // trust the height
102+ border : 'none' ,
103+ borderRadius : 'small' ,
104+ transition : 'all ease-in' ,
105+ transitionDuration : theme => theme . speeds [ 2 ] ,
106+
107+ ':focus' : {
108+ outline : 'none' ,
109+ } ,
110+ ':active' : {
111+ transform : 'scale(0.98)' ,
112+ } ,
113+ ':disabled' : {
114+ opacity : '0.4' ,
115+ cursor : 'not-allowed' ,
116+ } ,
117+ ...props . css ,
118+ }
119+ )
119120 )
120- )
121121) ;
122122
123123Button . defaultProps = {
0 commit comments