cfnz / muirwik

Muirwik - a Material UI React wrapper written in Kotlin
Mozilla Public License 2.0
132 stars 25 forks source link

immutable grid item element style #57

Closed sirakuzovsky closed 3 years ago

sirakuzovsky commented 3 years ago

Hi! I try to customize padding on mGridItem, but I can't. Think, there is no way doing this from Kotlin code, cause default MuiGrid style's has a major priority and code like this change nothing

mGridItem {
    css{paddingRight = 0.spacingUnits}
    attrs.xs = MGridSize.cells7
}
cfnz commented 3 years ago

Sometimes Material UI's styling is more specific than the css generated as in your example. One way around it is to apply a style to the mGridItem which is then more specific than Material UI's styling... e.g.

mGridItem(xs = MGridSize.cells6) {
    attrs.asDynamic().style = CSSBuilder().apply { paddingRight = 0.px }.toStyle()
    // Grid content
}
sirakuzovsky commented 3 years ago

Oh, thanks!