refactor: use typography styles

This commit is contained in:
José Oliveira 2021-03-29 20:19:06 +01:00 committed by Josh Harvey
parent 63b8e6a132
commit c581a56bad
4 changed files with 16 additions and 27 deletions

View file

@ -8,7 +8,7 @@ import { DeleteDialog } from 'src/components/DeleteDialog'
import { Link, IconButton } from 'src/components/buttons' import { Link, IconButton } from 'src/components/buttons'
import { Td, Tr } from 'src/components/fake-table/Table' import { Td, Tr } from 'src/components/fake-table/Table'
import { Switch } from 'src/components/inputs' import { Switch } from 'src/components/inputs'
import { TL2 } from 'src/components/typography' import { Label2 } from 'src/components/typography'
import { ReactComponent as DisabledDeleteIcon } from 'src/styling/icons/action/delete/disabled.svg' import { ReactComponent as DisabledDeleteIcon } from 'src/styling/icons/action/delete/disabled.svg'
import { ReactComponent as DeleteIcon } from 'src/styling/icons/action/delete/enabled.svg' import { ReactComponent as DeleteIcon } from 'src/styling/icons/action/delete/enabled.svg'
import { ReactComponent as DisabledEditIcon } from 'src/styling/icons/action/edit/disabled.svg' import { ReactComponent as DisabledEditIcon } from 'src/styling/icons/action/edit/disabled.svg'
@ -129,7 +129,7 @@ const ECol = ({ editing, focus, config, extraPaddingRight, extraPadding }) => {
textAlign, textAlign,
editingAlign = textAlign, editingAlign = textAlign,
suffix, suffix,
SuffixComponent = TL2, SuffixComponent = Label2,
textStyle = it => {}, textStyle = it => {},
view = it => it?.toString(), view = it => it?.toString(),
inputProps = {} inputProps = {}

View file

@ -23,8 +23,7 @@ export default {
} }
}, },
suffix: { suffix: {
marginLeft: 7, marginLeft: 7
fontSize: '12px'
}, },
size: ({ size }) => bySize(size), size: ({ size }) => bySize(size),
bold bold

View file

@ -1,6 +1,7 @@
import * as Yup from 'yup' import * as Yup from 'yup'
import { NumberInput } from 'src/components/inputs/formik' import { NumberInput } from 'src/components/inputs/formik'
import { bold } from 'src/styling/helpers'
const currencyMax = 999999999 const currencyMax = 999999999
const DenominationsSchema = Yup.object().shape({ const DenominationsSchema = Yup.object().shape({
@ -21,12 +22,6 @@ const DenominationsSchema = Yup.object().shape({
.max(currencyMax) .max(currencyMax)
}) })
const boldStyle = () => {
return {
fontWeight: 'bold'
}
}
const getElements = (machines, { fiatCurrency } = {}) => { const getElements = (machines, { fiatCurrency } = {}) => {
return [ return [
{ {
@ -48,7 +43,7 @@ const getElements = (machines, { fiatCurrency } = {}) => {
decimalPlaces: 0 decimalPlaces: 0
}, },
suffix: fiatCurrency, suffix: fiatCurrency,
textStyle: boldStyle bold: bold
}, },
{ {
name: 'bottom', name: 'bottom',
@ -61,7 +56,7 @@ const getElements = (machines, { fiatCurrency } = {}) => {
decimalPlaces: 0 decimalPlaces: 0
}, },
suffix: fiatCurrency, suffix: fiatCurrency,
textStyle: boldStyle bold: bold
}, },
{ {
name: 'zeroConfLimit', name: 'zeroConfLimit',
@ -74,7 +69,7 @@ const getElements = (machines, { fiatCurrency } = {}) => {
decimalPlaces: 0 decimalPlaces: 0
}, },
suffix: fiatCurrency, suffix: fiatCurrency,
textStyle: boldStyle bold: bold
} }
] ]
} }

View file

@ -6,6 +6,7 @@ import * as Yup from 'yup'
import { NumberInput } from 'src/components/inputs/formik' import { NumberInput } from 'src/components/inputs/formik'
import Autocomplete from 'src/components/inputs/formik/Autocomplete.js' import Autocomplete from 'src/components/inputs/formik/Autocomplete.js'
import { bold } from 'src/styling/helpers'
import { ReactComponent as TxInIcon } from 'src/styling/icons/direction/cash-in.svg' import { ReactComponent as TxInIcon } from 'src/styling/icons/direction/cash-in.svg'
import { ReactComponent as TxOutIcon } from 'src/styling/icons/direction/cash-out.svg' import { ReactComponent as TxOutIcon } from 'src/styling/icons/direction/cash-out.svg'
import { primaryColor, secondaryColorDark } from 'src/styling/variables' import { primaryColor, secondaryColorDark } from 'src/styling/variables'
@ -66,12 +67,6 @@ const onCryptoChange = (prev, curr, setValue) => {
setValue(curr) setValue(curr)
} }
const boldStyle = () => {
return {
fontWeight: 'bold'
}
}
const getOverridesFields = (getData, currency, auxElements) => { const getOverridesFields = (getData, currency, auxElements) => {
const machineData = [ALL_MACHINES].concat(getData(['machines'])) const machineData = [ALL_MACHINES].concat(getData(['machines']))
const rawCryptos = getData(['cryptoCurrencies']) const rawCryptos = getData(['cryptoCurrencies'])
@ -115,7 +110,7 @@ const getOverridesFields = (getData, currency, auxElements) => {
input: NumberInput, input: NumberInput,
textAlign: 'right', textAlign: 'right',
suffix: '%', suffix: '%',
textStyle: boldStyle, bold: bold,
inputProps: { inputProps: {
decimalPlaces: 3 decimalPlaces: 3
} }
@ -128,7 +123,7 @@ const getOverridesFields = (getData, currency, auxElements) => {
input: NumberInput, input: NumberInput,
textAlign: 'right', textAlign: 'right',
suffix: '%', suffix: '%',
textStyle: boldStyle, bold: bold,
inputProps: { inputProps: {
decimalPlaces: 3 decimalPlaces: 3
} }
@ -141,7 +136,7 @@ const getOverridesFields = (getData, currency, auxElements) => {
doubleHeader: 'Cash-in only', doubleHeader: 'Cash-in only',
textAlign: 'right', textAlign: 'right',
suffix: currency, suffix: currency,
textStyle: boldStyle, bold: bold,
inputProps: { inputProps: {
decimalPlaces: 2 decimalPlaces: 2
} }
@ -154,7 +149,7 @@ const getOverridesFields = (getData, currency, auxElements) => {
doubleHeader: 'Cash-in only', doubleHeader: 'Cash-in only',
textAlign: 'right', textAlign: 'right',
suffix: currency, suffix: currency,
textStyle: boldStyle, bold: bold,
inputProps: { inputProps: {
decimalPlaces: 2 decimalPlaces: 2
} }
@ -172,7 +167,7 @@ const mainFields = currency => [
editingAlign: 'right', editingAlign: 'right',
input: NumberInput, input: NumberInput,
suffix: '%', suffix: '%',
textStyle: boldStyle, bold: bold,
inputProps: { inputProps: {
decimalPlaces: 3 decimalPlaces: 3
} }
@ -186,7 +181,7 @@ const mainFields = currency => [
editingAlign: 'right', editingAlign: 'right',
input: NumberInput, input: NumberInput,
suffix: '%', suffix: '%',
textStyle: boldStyle, bold: bold,
inputProps: { inputProps: {
decimalPlaces: 3 decimalPlaces: 3
} }
@ -201,7 +196,7 @@ const mainFields = currency => [
editingAlign: 'right', editingAlign: 'right',
input: NumberInput, input: NumberInput,
suffix: currency, suffix: currency,
textStyle: boldStyle, bold: bold,
inputProps: { inputProps: {
decimalPlaces: 2 decimalPlaces: 2
} }
@ -216,7 +211,7 @@ const mainFields = currency => [
editingAlign: 'right', editingAlign: 'right',
input: NumberInput, input: NumberInput,
suffix: currency, suffix: currency,
textStyle: boldStyle, bold: bold,
inputProps: { inputProps: {
decimalPlaces: 2 decimalPlaces: 2
} }