equal
deleted
inserted
replaced
|
1 /* |
|
2 * Copyright 2017 Tomas Zeman <tzeman@volny.cz> |
|
3 * |
|
4 * Licensed under the Apache License, Version 2.0 (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 |
|
7 * |
|
8 * http://www.apache.org/licenses/LICENSE-2.0 |
|
9 * |
|
10 * Unless required by applicable law or agreed to in writing, software |
|
11 * distributed under the License is distributed on an "AS IS" BASIS, |
|
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
13 * See the License for the specific language governing permissions and |
|
14 * limitations under the License. |
|
15 */ |
|
16 package purecss.generic |
|
17 |
|
18 import scalatags.generic.{Bundle, Modifier} |
|
19 |
|
20 case class PureCls[Builder, Output <: FragT, FragT]( |
|
21 css: String, |
|
22 chain: List[PureCls[Builder, Output, FragT]] = Nil |
|
23 ) { |
|
24 |
|
25 type Self = PureCls[Builder, Output, FragT] |
|
26 |
|
27 def & (next: Self): Self = copy(chain = next :: chain) |
|
28 def & (next: String): Self = this & PureCls[Builder, Output, FragT](next) |
|
29 |
|
30 def apply()(implicit bundle: Bundle[Builder, Output, FragT]): |
|
31 Modifier[Builder] = { |
|
32 import bundle.all._ |
|
33 cls:=((this :: chain.reverse) map(_.css) mkString " ") |
|
34 } |
|
35 } |
|
36 |
|
37 |