fix mui button styles

This commit is contained in:
Mikhail Mikheev 2019-07-02 16:57:48 +04:00
parent 280f0cdddb
commit d0d542e82a
5 changed files with 24 additions and 25 deletions

View File

@ -1,31 +1,26 @@
// @flow // @flow
import * as React from 'react' 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'
const styles = {
root: {
borderRadius: 0,
},
}
type Props = { type Props = {
minWidth?: number, minWidth?: number,
minHeight?: number, minHeight?: number,
testId: string, rounded?: boolean,
testId?: string,
} }
const calculateStyleBased = (minWidth, minHeight) => ({ const calculateStyleBased = (minWidth, minHeight, rounded) => ({
minWidth: minWidth && `${minWidth}px`, minWidth: minWidth && `${minWidth}px`,
minHeight: minHeight && `${minHeight}px`, minHeight: minHeight && `${minHeight}px`,
borderRadius: rounded ? '4px' : 0,
}) })
const GnoButton = ({ const GnoButton = ({
minWidth, minHeight, testId = '', ...props minWidth, minHeight = 27, testId = '', rounded, ...props
}: Props) => { }: Props) => {
const style = calculateStyleBased(minWidth, minHeight) const style = calculateStyleBased(minWidth, minHeight, rounded)
return <Button style={style} data-testid={testId} {...props} /> return <Button style={style} data-testid={testId} {...props} />
} }
export default withStyles(styles)(GnoButton) export default GnoButton

View File

@ -2,16 +2,16 @@
import * as React from 'react' import * as React from 'react'
import { List } from 'immutable' import { List } from 'immutable'
import classNames from 'classnames/bind' import classNames from 'classnames/bind'
import { type Token } from '~/logic/tokens/store/model/token'
import CallMade from '@material-ui/icons/CallMade' import CallMade from '@material-ui/icons/CallMade'
import CallReceived from '@material-ui/icons/CallReceived' import CallReceived from '@material-ui/icons/CallReceived'
import Button from '@material-ui/core/Button'
import Checkbox from '@material-ui/core/Checkbox' import Checkbox from '@material-ui/core/Checkbox'
import TableRow from '@material-ui/core/TableRow' import TableRow from '@material-ui/core/TableRow'
import TableCell from '@material-ui/core/TableCell' import TableCell from '@material-ui/core/TableCell'
import { withStyles } from '@material-ui/core/styles' import { withStyles } from '@material-ui/core/styles'
import { type Token } from '~/logic/tokens/store/model/token'
import Col from '~/components/layout/Col' import Col from '~/components/layout/Col'
import Row from '~/components/layout/Row' import Row from '~/components/layout/Row'
import Button from '~/components/layout/Button'
import ButtonLink from '~/components/layout/ButtonLink' import ButtonLink from '~/components/layout/ButtonLink'
import Paragraph from '~/components/layout/Paragraph' import Paragraph from '~/components/layout/Paragraph'
import Modal from '~/components/Modal' import Modal from '~/components/Modal'
@ -168,10 +168,11 @@ class Balances extends React.Component<Props, State> {
<Button <Button
variant="contained" variant="contained"
size="small" size="small"
color="secondary" color="primary"
className={classes.send} className={classes.send}
onClick={() => this.showSendFunds(row.asset.name)} onClick={() => this.showSendFunds(row.asset.name)}
data-testid="balance-send-btn" rounded
testId="balance-send-btn"
> >
<CallMade className={classNames(classes.leftIcon, classes.iconSmall)} /> <CallMade className={classNames(classes.leftIcon, classes.iconSmall)} />
Send Send
@ -180,9 +181,10 @@ class Balances extends React.Component<Props, State> {
<Button <Button
variant="contained" variant="contained"
size="small" size="small"
color="secondary" color="primary"
className={classes.receive} className={classes.receive}
onClick={this.onShow('Receive')} onClick={this.onShow('Receive')}
rounded
> >
<CallReceived className={classNames(classes.leftIcon, classes.iconSmall)} /> <CallReceived className={classNames(classes.leftIcon, classes.iconSmall)} />
Receive Receive

View File

@ -11,7 +11,7 @@ import Row from '~/components/layout/Row'
import Paragraph from '~/components/layout/Paragraph' import Paragraph from '~/components/layout/Paragraph'
import Hairline from '~/components/layout/Hairline' import Hairline from '~/components/layout/Hairline'
import Button from '~/components/layout/Button' import Button from '~/components/layout/Button'
import { sm, boldFont } from '~/theme/variables' import { sm } from '~/theme/variables'
import { styles } from './style' import { styles } from './style'
const controlsStyle = { const controlsStyle = {
@ -19,11 +19,6 @@ const controlsStyle = {
padding: sm, padding: sm,
} }
const saveButtonStyle = {
marginRight: sm,
fontWeight: boldFont,
}
export const SAFE_NAME_INPUT_TESTID = 'safe-name-input' export const SAFE_NAME_INPUT_TESTID = 'safe-name-input'
export const SAFE_NAME_SUBMIT_BTN_TESTID = 'change-safe-name-btn' export const SAFE_NAME_SUBMIT_BTN_TESTID = 'change-safe-name-btn'
@ -74,7 +69,7 @@ const ChangeSafeName = (props: Props) => {
<Col end="xs"> <Col end="xs">
<Button <Button
type="submit" type="submit"
style={saveButtonStyle} className={classes.saveBtn}
size="small" size="small"
variant="contained" variant="contained"
color="primary" color="primary"

View File

@ -1,5 +1,5 @@
// @flow // @flow
import { lg } from '~/theme/variables' import { lg, sm, boldFont } from '~/theme/variables'
export const styles = () => ({ export const styles = () => ({
title: { title: {
@ -14,4 +14,8 @@ export const styles = () => ({
display: 'flex', display: 'flex',
maxWidth: '460px', maxWidth: '460px',
}, },
saveBtn: {
marginRight: sm,
fontWeight: boldFont,
},
}) })

View File

@ -43,6 +43,9 @@ export default createMuiTheme({
}, },
overrides: { overrides: {
MuiButton: { MuiButton: {
label: {
lineHeight: 1,
},
root: { root: {
fontFamily: 'Roboto Mono, monospace', fontFamily: 'Roboto Mono, monospace',
letterSpacing: '0.9px', letterSpacing: '0.9px',