shared/src/main/scala/purecss/generic/PureCls.scala
changeset 16 bdde11c9c9fd
parent 10 f4bf01584928
equal deleted inserted replaced
15:63c0ad93cd52 16:bdde11c9c9fd
     1 /*
     1 /*
     2  * Copyright 2017-2018 Tomas Zeman <tzeman@volny.cz>
     2  * Copyright 2017-2019 Tomas Zeman <tomas@functionals.cz>
     3  *
     3  *
     4  * Licensed under the Apache License, Version 2.0 (the "License");
     4  * Licensed under the Apache License, Version 2.0 (the "License");
     5  * you may not use this file except in compliance with the License.
     5  * you may not use this file except in compliance with the License.
     6  * You may obtain a copy of the License at
     6  * You may obtain a copy of the License at
     7  *
     7  *
    22   chain: List[PureCls[Builder, Output, FragT]] = Nil
    22   chain: List[PureCls[Builder, Output, FragT]] = Nil
    23 ) {
    23 ) {
    24 
    24 
    25   type Self = PureCls[Builder, Output, FragT]
    25   type Self = PureCls[Builder, Output, FragT]
    26 
    26 
    27   def & (next: Self): Self = copy(chain = next :: chain)
    27   def add(next: Self): Self = copy(chain = next :: chain)
    28   def & (next: String): Self = this & PureCls[Builder, Output, FragT](next)
    28   def add(next: String): Self = this & PureCls[Builder, Output, FragT](next)
       
    29 
       
    30   def & (next: Self): Self = add(next)
       
    31   def & (next: String): Self = add(next)
       
    32 
       
    33   def + (next: Self): Self = add(next)
       
    34   def + (next: String): Self = add(next)
    29 
    35 
    30   def apply()(implicit bundle: Bundle[Builder, Output, FragT]):
    36   def apply()(implicit bundle: Bundle[Builder, Output, FragT]):
    31   Modifier[Builder] = {
    37   Modifier[Builder] = {
    32     import bundle.all._
    38     import bundle.all._
    33     cls:=asCss
    39     cls:=asCss
    34   }
    40   }
    35 
    41 
    36   def asCss: String = (this :: chain.reverse) map(_.css) mkString " "
    42   def asCss: String = (this :: chain.reverse) map(_.css) mkString " "
    37 }
    43 }
    38 
       
    39