These are chat archives for japgolly/scalacss

16th
Jun 2015
Chandra Sekhar Kode
@chandu0101
Jun 16 2015 17:22
is there any way to pass a number to style ?
//pseudo code
val x = stylefunc(num)(num => flex := num.toString)
Matt Hughes
@matthughes
Jun 16 2015 18:58
not intDomain stuff?
Chandra Sekhar Kode
@chandu0101
Jun 16 2015 18:59
number is passed by end user , i have no control i just want to store what ever user passes ..
it looks like styleF is for defined bounds ? :s
Matt Hughes
@matthughes
Jun 16 2015 19:00
Where do you want to call this function from? All styles need to be declared before you add to the stylesheet.
Chandra Sekhar Kode
@chandu0101
Jun 16 2015 19:00
case class Props(i : Int)
<.div(Style.x(props.i))
Matt Hughes
@matthughes
Jun 16 2015 19:01
Yeah either have to know the domain beforehand or just inline that style.
Chandra Sekhar Kode
@chandu0101
Jun 16 2015 19:01
yeah inline is what i am doing right now :)
wondering if its possible in scalacss .. , do you think its good to have a feature like this ?
Matt Hughes
@matthughes
Jun 16 2015 19:03
Feature Request: <.div(InlineStyle(x(props.i))). Instead of converting to className := “stylename”, puts all the style properties inline. Would like for a number of reasons. Though not sure how big of a change that is with existing codebase as the current DSL allows you to write things that can only go in stylesheets (media queries, psuedoelements). Ideally something like InlineStyle wouldn’t permit those attributes.
At the very least, I’d love to be able to take advantage of the typed style work done in ScalaCSS. Some attributes are typed in reactjs, but I wish I could just say: <.div(backgroundColor(Color(…)) without creating a style sometimes. But I can’t use that syntax. I have to fallback to <.div(backgroundColor := “someColor”))
Chandra Sekhar Kode
@chandu0101
Jun 16 2015 19:10
yeah , let see what @japgolly will say ..