Big Chungus
03/19/2021, 1:03 PMtypealias StyledComponent<E> = RenderContext.(style: BoxParams.() -> Unit, block: E.() -> Unit) -> E
fun <E> styled(component: BasicComponent<E>): StyledComponent<E> = { style, block ->
(component.styled(styling = style))(block)
}
//usage
fun RenderContext.preview() {
styled(::div)({
// div style
}) {
// div code and inner layout
div {
// child unstyled div
}
}
}
Jan Weidenhaupt
03/19/2021, 1:38 PM