Browse Source
The idea is that every API call that has builder deserves to have a separate filepull/869/head
Shagen Ogandzhanian
3 years ago
2 changed files with 51 additions and 44 deletions
@ -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…
Reference in new issue