Browse Source

Move border-related CSS API calls to a separate file

The idea is that every API call that has builder deserves to have a
separate file
pull/869/head
Shagen Ogandzhanian 3 years ago
parent
commit
b294b732c0
  1. 44
      web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/CSSProperties.kt
  2. 51
      web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/properties/border.kt

44
web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/CSSProperties.kt

@ -63,22 +63,6 @@ inline fun CSSBorder.color(color: CSSColorValue) {
this.color = color
}
inline fun StyleBuilder.border(crossinline borderBuild: CSSBorder.() -> Unit) {
property("border", CSSBorder().apply(borderBuild))
}
fun StyleBuilder.border(
width: CSSLengthValue? = null,
style: LineStyle? = null,
color: CSSColorValue? = null
) {
border {
width?.let { width(it) }
style?.let { style(it) }
color?.let { color(it) }
}
}
fun StyleBuilder.display(displayStyle: DisplayStyle) {
property("display", displayStyle.value)
}
@ -132,34 +116,6 @@ fun StyleBuilder.position(position: Position) {
)
}
fun StyleBuilder.borderRadius(r: CSSNumeric) {
property("border-radius", r)
}
fun StyleBuilder.borderRadius(topLeft: CSSNumeric, bottomRight: CSSNumeric) {
property("border-radius", "$topLeft $bottomRight")
}
fun StyleBuilder.borderRadius(
topLeft: CSSNumeric,
topRightAndBottomLeft: CSSNumeric,
bottomRight: CSSNumeric
) {
property("border-radius", "$topLeft $topRightAndBottomLeft $bottomRight")
}
fun StyleBuilder.borderRadius(
topLeft: CSSNumeric,
topRight: CSSNumeric,
bottomRight: CSSNumeric,
bottomLeft: CSSNumeric
) {
property(
"border-radius",
"$topLeft $topRight $bottomRight $bottomLeft"
)
}
fun StyleBuilder.width(value: CSSNumeric) {
property("width", value)
}

51
web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/properties/border.kt

@ -0,0 +1,51 @@
/*
* Copyright 2020-2021 JetBrains s.r.o. and respective authors and developers.
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file.
*/
package org.jetbrains.compose.web.css
inline fun StyleBuilder.border(crossinline borderBuild: CSSBorder.() -> Unit) {
property("border", CSSBorder().apply(borderBuild))
}
fun StyleBuilder.border(
width: CSSLengthValue? = null,
style: LineStyle? = null,
color: CSSColorValue? = null
) {
border {
width?.let { width(it) }
style?.let { style(it) }
color?.let { color(it) }
}
}
fun StyleBuilder.borderRadius(r: CSSNumeric) {
property("border-radius", r)
}
fun StyleBuilder.borderRadius(topLeft: CSSNumeric, bottomRight: CSSNumeric) {
property("border-radius", "$topLeft $bottomRight")
}
fun StyleBuilder.borderRadius(
topLeft: CSSNumeric,
topRightAndBottomLeft: CSSNumeric,
bottomRight: CSSNumeric
) {
property("border-radius", "$topLeft $topRightAndBottomLeft $bottomRight")
}
fun StyleBuilder.borderRadius(
topLeft: CSSNumeric,
topRight: CSSNumeric,
bottomRight: CSSNumeric,
bottomLeft: CSSNumeric
) {
property(
"border-radius",
"$topLeft $topRight $bottomRight $bottomLeft"
)
}
Loading…
Cancel
Save