These are chat archives for japgolly/scalacss

22nd
Jun 2015
Yuriy Badalyantc
@LMnet
Jun 22 2015 12:52

I need some help with styleC. I tried to create minimal example with styleC. I used example from the docs. Here is my code:

package main

import scalacss.Defaults._

object MyStyles extends StyleSheet.Inline {
  import dsl._

  val example = styleC {
    val top = styleS(display.block)
    val lbl = styleS(fontWeight.bold)
    val chk = styleS(backgroundColor.red, marginLeft(1 ex))
    top.named('outer) :*: lbl.named('label) :*: chk.named('checkbox)
  }
}

object Main extends App {
  val st = MyStyles.example('outer   )(outerStyle =>
                          _('label   )(labelStyle =>
                          _('checkbox)(inputStyle =>
        true
      )))

  println(st)
}

The first thing - it doesn't compile. The second - I don't fully understand how should I use styleC styles. I just tried to return true for now. And the third - is this syntax is the only syntax that can solve this issue (on the lib level)? It looks really awkward and unreadable.

Compile error:
[info] Compiling 2 Scala sources to /data/IT/Projects/tmp/scalacss-test/target/scala-2.11/classes...
[error] /data/IT/Projects/tmp/scalacss-test/src/main/scala/main/Main.scala:17: type mismatch;
[error]  found   : Symbol
[error]  required: Symbol with shapeless.tag.Tagged[String("outer")]
[error]   val st = MyStyles.example('outer   )(outerStyle =>
[error]                             ^
[error] /data/IT/Projects/tmp/scalacss-test/src/main/scala/main/Main.scala:18: missing parameter type for expanded function ((x$3) => x$3(scala.Symbol("label"))(((labelStyle) => ((x$4) => x$4(scala.Symbol("checkbox"))(((inputStyle) => true))))))
[error]     _('label   )(labelStyle =>
[error]     ^
[error] two errors found
[error] (compile:compileIncremental) Compilation failed
[error] Total time: 1 s, completed Jun 22, 2015 6:48:22 PM
Chandra Sekhar Kode
@chandu0101
Jun 22 2015 14:18
japgolly/scalacss#48
Yuriy Badalyantc
@LMnet
Jun 22 2015 16:23
oh...ok