More properties
This commit is contained in:
30
src/commonMain/kotlin/nl/astraeus/css/Count.kt
Normal file
30
src/commonMain/kotlin/nl/astraeus/css/Count.kt
Normal 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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user