Skip to content

Commit

Permalink
Use a createMultiStyleConfigHelpers to define styles
Browse files Browse the repository at this point in the history
  • Loading branch information
kkosiorowska committed Dec 14, 2023
1 parent 8e9d87e commit 3ff12eb
Showing 1 changed file with 99 additions and 77 deletions.
176 changes: 99 additions & 77 deletions dapp/src/theme/CurrencyBalance.ts
Original file line number Diff line number Diff line change
@@ -1,84 +1,106 @@
import { ComponentMultiStyleConfig } from "@chakra-ui/react"
import { createMultiStyleConfigHelpers, defineStyle } from "@chakra-ui/react"

const CurrencyBalance: ComponentMultiStyleConfig = {
parts: ["balance", "symbol"],
baseStyle: {
balance: {
fontWeight: "bold",
fontSize: "md",
lineHeight: "md",
mr: 1,
},
symbol: {
fontWeight: "bold",
fontSize: "md",
lineHeight: "md",
},
const PARTS = ["balance", "symbol"]

const { defineMultiStyleConfig, definePartsStyle } =
createMultiStyleConfigHelpers(PARTS)

const baseStyleBalance = defineStyle({
fontWeight: "bold",
fontSize: "md",
lineHeight: "md",
mr: 1,
})

const baseStyleSymbol = defineStyle({
fontWeight: "bold",
fontSize: "md",
lineHeight: "md",
})

const baseStyle = definePartsStyle({
balance: baseStyleBalance,
symbol: baseStyleSymbol,
})

const variantGreaterBalance = definePartsStyle({
balance: {
fontSize: "4xl",
lineHeight: "4xl",
},
symbol: {
fontSize: "xl",
lineHeight: "xl",
},
variants: {
"greater-balance": {
balance: {
fontSize: "4xl",
lineHeight: "4xl",
},
symbol: {
fontSize: "xl",
lineHeight: "xl",
},
},
})

const variants = {
"greater-balance": variantGreaterBalance,
}

const sizeXs = definePartsStyle({
balance: {
fontSize: "xs",
lineHeight: "xs",
},
symbol: {
fontSize: "xs",
lineHeight: "xs",
},
})

const sizeSm = definePartsStyle({
balance: {
fontSize: "sm",
lineHeight: "sm",
},
sizes: {
xs: {
balance: {
fontSize: "xs",
lineHeight: "xs",
},
symbol: {
fontSize: "xs",
lineHeight: "xs",
},
},
sm: {
balance: {
fontSize: "sm",
lineHeight: "sm",
},
symbol: {
fontSize: "sm",
lineHeight: "sm",
},
},
md: {
balance: {
fontSize: "md",
lineHeight: "md",
},
symbol: {
fontSize: "md",
lineHeight: "md",
},
},
lg: {
balance: {
fontSize: "lg",
lineHeight: "lg",
},
symbol: {
fontSize: "lg",
lineHeight: "lg",
},
},
xl: {
balance: {
fontSize: "xl",
lineHeight: "xl",
},
symbol: {
fontSize: "xl",
lineHeight: "xl",
},
},
symbol: {
fontSize: "sm",
lineHeight: "sm",
},
})

const sizeMd = definePartsStyle({
balance: {
fontSize: "md",
lineHeight: "md",
},
symbol: {
fontSize: "md",
lineHeight: "md",
},
})

const sizeLg = definePartsStyle({
balance: {
fontSize: "lg",
lineHeight: "lg",
},
symbol: {
fontSize: "lg",
lineHeight: "lg",
},
})

const sizeXl = definePartsStyle({
balance: {
fontSize: "xl",
lineHeight: "xl",
},
symbol: {
fontSize: "xl",
lineHeight: "xl",
},
})

const sizes = {
xs: sizeXs,
sm: sizeSm,
md: sizeMd,
lg: sizeLg,
xl: sizeXl,
}

const CurrencyBalance = defineMultiStyleConfig({ baseStyle, variants, sizes })

export default CurrencyBalance

0 comments on commit 3ff12eb

Please sign in to comment.