From fb63c43394c1b7a9937bc82ea6512904f06ce2b2 Mon Sep 17 00:00:00 2001 From: Shagen Ogandzhanian Date: Tue, 20 Jul 2021 00:04:55 +0200 Subject: [PATCH] Use max/minWidth/Height call in samples --- .../jsMain/kotlin/com/sample/style/Stylesheet.kt | 5 ++--- .../src/jsMain/kotlin/com/sample/style/WtCard.kt | 6 +++--- .../src/jsMain/kotlin/com/sample/style/WtCol.kt | 16 ++++------------ .../kotlin/com/sample/style/WtContainer.kt | 8 ++++---- 4 files changed, 13 insertions(+), 22 deletions(-) diff --git a/web/benchmark-core/src/jsMain/kotlin/com/sample/style/Stylesheet.kt b/web/benchmark-core/src/jsMain/kotlin/com/sample/style/Stylesheet.kt index a1af8dc043..2f4dcd430b 100644 --- a/web/benchmark-core/src/jsMain/kotlin/com/sample/style/Stylesheet.kt +++ b/web/benchmark-core/src/jsMain/kotlin/com/sample/style/Stylesheet.kt @@ -26,7 +26,7 @@ object AppCSSVariables : CSSVariables { object AppStylesheet : StyleSheet() { val composeLogo by style { - property("max-width", 100.percent) + maxWidth(100.percent) } val composeTitleTag by style { @@ -85,8 +85,7 @@ object AppStylesheet : StyleSheet() { "flex-basis", "calc(8.33333%*${AppCSSVariables.wtColCount.value()} - ${AppCSSVariables.wtHorizontalLayoutGutter.value()}*2)" ) - property( - "max-width", + maxWidth( "calc(8.33333%*${AppCSSVariables.wtColCount.value()} - ${AppCSSVariables.wtHorizontalLayoutGutter.value()}*2)" ) property("box-sizing", "border-box") diff --git a/web/benchmark-core/src/jsMain/kotlin/com/sample/style/WtCard.kt b/web/benchmark-core/src/jsMain/kotlin/com/sample/style/WtCard.kt index 4cbb24e3fe..53bd6e3c71 100644 --- a/web/benchmark-core/src/jsMain/kotlin/com/sample/style/WtCard.kt +++ b/web/benchmark-core/src/jsMain/kotlin/com/sample/style/WtCard.kt @@ -7,7 +7,7 @@ object WtCards : StyleSheet(AppStylesheet) { display(DisplayStyle.Flex) flexDirection(FlexDirection.Column) border(1.px, LineStyle.Solid) - property("min-height", 0) + minHeight(0.px) property("box-sizing", "border-box") } @@ -27,7 +27,7 @@ object WtCards : StyleSheet(AppStylesheet) { position(Position.Relative) property("overflow", "auto") property("flex", "1 1 auto") - property("min-height", 0) + minHeight(0.px) property("box-sizing", "border-box") property("padding", "24px 32px") @@ -44,6 +44,6 @@ object WtCards : StyleSheet(AppStylesheet) { val wtVerticalFlexGrow by style { flexGrow(1) - property("max-width", 100.percent) + maxWidth(100.percent) } } \ No newline at end of file diff --git a/web/benchmark-core/src/jsMain/kotlin/com/sample/style/WtCol.kt b/web/benchmark-core/src/jsMain/kotlin/com/sample/style/WtCol.kt index 641e116659..36f4b4de5d 100644 --- a/web/benchmark-core/src/jsMain/kotlin/com/sample/style/WtCol.kt +++ b/web/benchmark-core/src/jsMain/kotlin/com/sample/style/WtCol.kt @@ -1,14 +1,6 @@ package com.sample.style -import org.jetbrains.compose.web.css.CSSBuilder -import org.jetbrains.compose.web.css.CSSUnitValue -import org.jetbrains.compose.web.css.GenericStyleSheetBuilder -import org.jetbrains.compose.web.css.StyleSheet -import org.jetbrains.compose.web.css.flexGrow -import org.jetbrains.compose.web.css.mediaMaxWidth -import org.jetbrains.compose.web.css.media -import org.jetbrains.compose.web.css.percent -import org.jetbrains.compose.web.css.px +import org.jetbrains.compose.web.css.* import org.jetbrains.compose.web.css.selectors.CSSSelector fun GenericStyleSheetBuilder.mediaMaxWidth( @@ -118,19 +110,19 @@ object WtCols : StyleSheet(AppStylesheet) { forMaxWidth(640.px) { AppCSSVariables.wtColCount(0) flexGrow(1) - property("max-width", 100.percent) + maxWidth(100.percent) } } val wtColAutoFill by style { AppCSSVariables.wtColCount(0) flexGrow(1) - property("max-width", 100.percent) + maxWidth(100.percent) } val wtColInline by style { AppCSSVariables.wtColCount(0) - property("max-width", 100.percent) + maxWidth(100.percent) property("flex-basis", "auto") } } diff --git a/web/benchmark-core/src/jsMain/kotlin/com/sample/style/WtContainer.kt b/web/benchmark-core/src/jsMain/kotlin/com/sample/style/WtContainer.kt index d33f70f607..c1b56baeff 100644 --- a/web/benchmark-core/src/jsMain/kotlin/com/sample/style/WtContainer.kt +++ b/web/benchmark-core/src/jsMain/kotlin/com/sample/style/WtContainer.kt @@ -9,11 +9,11 @@ object WtContainer : StyleSheet(AppStylesheet) { property("box-sizing", "border-box") property("padding-left", 22.px) property("padding-right", 22.px) - property("max-width", 1276.px) + maxWidth(1276.px) media(mediaMaxWidth(640.px)) { self style { - property("max-width", 100.percent) + maxWidth(100.percent) property("padding-left", 16.px) property("padding-right", 16.px) } @@ -21,7 +21,7 @@ object WtContainer : StyleSheet(AppStylesheet) { media(mediaMaxWidth(1276.px)) { self style { - property("max-width", 996.px) + maxWidth(996.px) property("padding-left", 996.px) property("padding-right", 22.px) } @@ -29,7 +29,7 @@ object WtContainer : StyleSheet(AppStylesheet) { media(mediaMaxWidth(1000.px)) { self style { - property("max-width", 100.percent) + maxWidth(100.percent) property("padding-left", 22.px) property("padding-right", 22.px) }