Partho Paul
03/01/2022, 12:15 PMturansky
03/01/2022, 12:22 PMEarlier we were using Stylesheet from kotlin-styledDo you have example? cc @Sergei Grishchenko
Partho Paul
03/01/2022, 12:32 PMSergei Grishchenko
03/01/2022, 12:34 PMreact-css
package and we (personally me) wanted to support full emotions apiSergei Grishchenko
03/01/2022, 12:35 PMPartho Paul
03/01/2022, 12:40 PMSergei Grishchenko
03/01/2022, 12:54 PMreact-css
)
val createDialog = functionComponent<CreateBuildProps> { props ->
mDialog(
fullScreen = true
) {
mFormGroup {
css(ComponentStyles.formStyle)
div {
css = {
margin(1.spacingUnits)
minWidth = 300.px
maxWidth = 500.px
}
// and so on for other elements
}
}
}
}
Sergei Grishchenko
03/01/2022, 12:56 PMcss prop
for MUI components like mFormGroup
@turansky?turansky
03/01/2022, 12:57 PMclassName = ComponentStyles.formStyle
Sergei Grishchenko
03/01/2022, 12:58 PMformStyle
is not a string at all (but I can be wrong)Sergei Grishchenko
03/01/2022, 12:59 PMformStyle
might be declared style (not rendered yet)Partho Paul
03/01/2022, 12:59 PMturansky
03/01/2022, 1:00 PMclassName
- property of FormGroup
turansky
03/01/2022, 1:01 PMcss
block requiredPartho Paul
03/01/2022, 1:11 PMclassName
of FormGroup
also takes String so still getting the above errorSergei Grishchenko
03/01/2022, 1:12 PMimport emotion.css.css // <- pay attention here
private object ComponentStyles {
val formControl = css(jso {
margin(1.spacingUnits)
minWidth = 300.px
maxWidth = 500.px
})
val button = css(jso {
margin(top = 10.spacingUnits, 1.spacingUnits, 1.spacingUnits, 1.spacingUnits)
minWidth = 300.px
maxWidth = 500.px
})
val formStyle = css(jso {
display = Display.flex
flexDirection = FlexDirection.column
justifyContent = JustifyContent.center
alignItems = Align.center
paddingBottom = 4.spacingUnits
margin = Align.auto.toString()
width = 50.pct
})
}
className = ComponentStyles.formStyle // <- in components
Sergei Grishchenko
03/01/2022, 1:13 PMemotion.css.css
is imported from kotlin-emotion
libSergei Grishchenko
03/01/2022, 1:14 PMPartho Paul
03/01/2022, 1:15 PMSergei Grishchenko
03/01/2022, 1:16 PMcsstype
Sergei Grishchenko
03/01/2022, 1:18 PMmargin(1.spacingUnits)
is invalid in new DSL, use something like this margin = 1.spacingUnits
@turansky correct me if I wrongturansky
03/01/2022, 1:22 PMspacingUnits
What is in vanila CSS?turansky
03/01/2022, 1:23 PMSergei Grishchenko
03/01/2022, 1:23 PMval Int.spacingUnits = (this * 4).px
Sergei Grishchenko
03/01/2022, 1:23 PMPartho Paul
03/01/2022, 1:32 PMSergei Grishchenko
03/01/2022, 1:33 PMturansky
03/01/2022, 1:33 PMPartho Paul
03/08/2022, 8:47 AMclassName
approach didn't work as it was getting overridden by the parent element's css. For now I've used the sx
attribute for each element wherever required (wanted to avoid this because of code duplication).
Thanks for your help anyway 🙂turansky
03/08/2022, 9:14 AMPartho Paul
03/08/2022, 10:00 AMTransitionComponent
as well? I couldn't find it in showcase and tables project. In my use case, I want to use slide
transitionComponent for opening a dialog
.turansky
03/08/2022, 10:27 AMaerialist
03/30/2022, 7:59 PM