Moving min-width button prop from theme to its custom component

This commit is contained in:
apanizo 2018-09-03 13:26:18 +02:00
parent 7c990e671a
commit d2254e1827
3 changed files with 18 additions and 2 deletions

View File

@ -1,4 +1,5 @@
// @flow
import * as React from 'react'
import Button from '@material-ui/core/Button'
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)

View File

@ -33,6 +33,7 @@ export const CreateSafe = ({ size, provider }: SafeProps) => (
size={size || 'medium'}
color="primary"
disabled={!provider}
minWidth={275}
>
<Img src={plus} height={16} alt="Safe" />
<div style={buttonStyle}>Create a new Safe</div>
@ -47,6 +48,7 @@ export const LoadSafe = ({ size, provider }: SafeProps) => (
size={size || 'medium'}
color="primary"
disabled={!provider}
minWidth={275}
>
<Img src={safe} height={16} alt="Safe" />
<div style={buttonStyle}>Load existing Safe</div>

View File

@ -38,7 +38,6 @@ export default createMuiTheme({
padding: `${md} ${xl}`,
minHeight: '52px',
fontSize: mediumFontSize,
minWidth: '275px',
},
},
},