Moving min-width button prop from theme to its custom component
This commit is contained in:
parent
7c990e671a
commit
d2254e1827
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
import * as React from 'react'
|
||||||
import Button from '@material-ui/core/Button'
|
import Button from '@material-ui/core/Button'
|
||||||
import { withStyles } from '@material-ui/core/styles'
|
import { withStyles } from '@material-ui/core/styles'
|
||||||
|
|
||||||
|
@ -8,4 +9,18 @@ const styles = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
export default withStyles(styles)(Button)
|
type Props = {
|
||||||
|
minWidth?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
const calculateStyleBased = minWidth => ({
|
||||||
|
minWidth: `${minWidth}px`,
|
||||||
|
})
|
||||||
|
|
||||||
|
const GnoButton = ({ minWidth, ...props }: Props) => {
|
||||||
|
const style = minWidth ? calculateStyleBased(minWidth) : undefined
|
||||||
|
|
||||||
|
return <Button style={style} {...props} />
|
||||||
|
}
|
||||||
|
|
||||||
|
export default withStyles(styles)(GnoButton)
|
||||||
|
|
|
@ -33,6 +33,7 @@ export const CreateSafe = ({ size, provider }: SafeProps) => (
|
||||||
size={size || 'medium'}
|
size={size || 'medium'}
|
||||||
color="primary"
|
color="primary"
|
||||||
disabled={!provider}
|
disabled={!provider}
|
||||||
|
minWidth={275}
|
||||||
>
|
>
|
||||||
<Img src={plus} height={16} alt="Safe" />
|
<Img src={plus} height={16} alt="Safe" />
|
||||||
<div style={buttonStyle}>Create a new Safe</div>
|
<div style={buttonStyle}>Create a new Safe</div>
|
||||||
|
@ -47,6 +48,7 @@ export const LoadSafe = ({ size, provider }: SafeProps) => (
|
||||||
size={size || 'medium'}
|
size={size || 'medium'}
|
||||||
color="primary"
|
color="primary"
|
||||||
disabled={!provider}
|
disabled={!provider}
|
||||||
|
minWidth={275}
|
||||||
>
|
>
|
||||||
<Img src={safe} height={16} alt="Safe" />
|
<Img src={safe} height={16} alt="Safe" />
|
||||||
<div style={buttonStyle}>Load existing Safe</div>
|
<div style={buttonStyle}>Load existing Safe</div>
|
||||||
|
|
|
@ -38,7 +38,6 @@ export default createMuiTheme({
|
||||||
padding: `${md} ${xl}`,
|
padding: `${md} ${xl}`,
|
||||||
minHeight: '52px',
|
minHeight: '52px',
|
||||||
fontSize: mediumFontSize,
|
fontSize: mediumFontSize,
|
||||||
minWidth: '275px',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue