More properties

This commit is contained in:
2020-02-10 20:28:57 +01:00
parent 1b83f88c8f
commit 1c3ac8f0d0
14 changed files with 229 additions and 27 deletions

View File

@@ -0,0 +1,30 @@
package nl.astraeus.css
enum class CountType {
NUMBER,
INFINITE,
INITIAL,
INHERIT
}
class Count(
val type: CountType,
val number: Int
) : CssProperty {
override fun css(): String = when(type) {
CountType.NUMBER -> "$number"
CountType.INFINITE -> "infinite"
CountType.INITIAL -> "initial"
CountType.INHERIT -> "inherit"
}
companion object {
fun count(number: Int): Count = Count(CountType.NUMBER, number)
fun infinite(): Count = Count(CountType.INFINITE, 0)
fun initial(): Count = Count(CountType.INITIAL, 0)
fun inherit(): Count = Count(CountType.INHERIT, 0)
}
}