These are chat archives for japgolly/scalacss

17th
Apr 2015
Chandra Sekhar Kode
@chandu0101
Apr 17 2015 13:49
whats the best way to define stylesheets for resuable components ?
This message was deleted
object NewStyle extends ReactListView.Style {
override val listGroup  = style(super.listGroup // this is not possible as its val ,
paddingLeft(2 px))
}

ReactListView(items = List(“scala”,”scalajs”) , style = NewStyle)
how can i acheive something similar to that !
David Barri
@japgolly
Apr 17 2015 22:09
oh jeez, I didn't know Scala doesn't allow super with vals. That's annoying.
I guess you could do
    def listGroupMixin = mixin(marginBottom(20.px),
      paddingLeft.`0`,
      &.firstChild.lastChild(borderBottomLeftRadius(4 px),
        borderBottomRightRadius(4 px))
    )
    val listGroup = style(listGroupMixin)
override val listGroup  = style(
   listGroupMixin, paddingLeft(2 px))
Alternatively, you could do this which is a bit of a hack, but less work:
object NewStyle extends ReactListView.Style {
  val original = new ReactListView.Style
  override val listGroup = style(
    original.listGroup.style,
    paddingLeft(2 px))
}
Anton Kulaga
@antonkulaga
Apr 17 2015 23:40
I prefer to use lazy vals instead of vals where possible as it decreases risks of some errors