Hey, this might come handy to you as well. I've wr...
# fritz2
b
Hey, this might come handy to you as well. I've written a small utility function that helps in keeping styled component DSL consistent with fritz2 components lib DSL (also I find this a lot more readable):
Copy code
typealias 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
    } 
  }
}
j
Thank you for the idea! If have opened an issue on github for it https://github.com/jwstegemann/fritz2/issues/322