Skip to content

Commit

Permalink
fix: support for segmented media queries in buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlLiu2023 authored and BrianJiang2021 committed Jul 11, 2023
1 parent c77fa68 commit 546167b
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const splitCustomCssValue = (customCss: string) => {

return {
mediaBlocks,
cssValue,
cssValue: cssValue.trim(),
}
}

Expand All @@ -40,6 +40,10 @@ export const setMediaStyle = (mediaBlocks: string[], className: string) => {
const newCustomCss = mediaBlocks.map((media: string) => {
const mediaArr = media.split('\n')
const newMediaArr = mediaArr.map((style) => {
if (style.includes('@media')) {
return style
}

const [property, value] = style.split(':')
let newValue = value

Expand Down Expand Up @@ -81,7 +85,7 @@ export const setMUIMediaStyle = (mediaBlocks: string[]) => {
const mediaArr = media.split('\n')
const first = mediaArr.find((item) => item.includes('@media'))
if (first) {
const key = `${first.split(')')[0]})`
const key = first.split('{')[0]

mediaArr.forEach((style) => {
const [property, value] = style.split(':')
Expand Down

0 comments on commit 546167b

Please sign in to comment.