Hildebrandt Tobias
10/24/2024, 12:16 PMsx {
xs {
paddingLeft = spacing(1)
}
paddingLeft {
xs = spacing(1)
}
}Hildebrandt Tobias
10/24/2024, 12:29 PMisMobile, but the
Toolbar Component for example sets paddingLeft to 24px in the @media(width:600px) style, but when I do
sx { paddingLeft = 8.px }
it's not overwritten there, just in the normal style of the Toolbar.Hildebrandt Tobias
10/24/2024, 12:37 PMHildebrandt Tobias
10/24/2024, 12:40 PMsx { breakpoints.up(Breakpoint.sm)) { paddingLeft = spacing(1) } }Hildebrandt Tobias
10/24/2024, 12:42 PMsx { "@media(min-width:600px)" { paddingLeft = spacing(1) } }
or
media(MediaQuery((breakpoints.up(Breakpoint.sm)))) { paddingLeft = spacing(1) }
Is there a better/shorter way available? (if not I'll just make an extension function)turansky
10/24/2024, 2:46 PMLooks like return type of expression should bebreakpoints.up(Breakpoint.sm)
MediaQuery 😞Hildebrandt Tobias
10/25/2024, 11:49 AMMediaQuery seems to just be a wrapped String.
And `breakpoints.up(Breakpoint.sm)`already returns @media (min-width: 600px)
the media function already adds a @media though, so
media(MediaQuery((breakpoints.up(Breakpoint.sm)))) { paddingLeft = spacing(1) }
actually doesn't work since it applies @media @media (min-width: 600px) .Hildebrandt Tobias
10/25/2024, 11:51 AMcontext(Theme)
fun PropertiesBuilder.xs(
block: PropertiesBuilder.() -> Unit
) = (breakpoints.up(Breakpoint.sm)) {
block()
}Hildebrandt Tobias
10/25/2024, 11:53 AMsx {
xs { paddingLeft = spacing(2) }
sm { paddingLeft = spacing(4) }
xl { paddingLeft = spacing(6) }
}