Skip to content

Commit

Permalink
Update examples to 0.5.0-build221
Browse files Browse the repository at this point in the history
Schahen committed Jun 8, 2021
1 parent 9698698 commit 492a522
Showing 19 changed files with 120 additions and 122 deletions.
2 changes: 1 addition & 1 deletion examples/falling_balls_with_web/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import org.jetbrains.compose.desktop.application.dsl.TargetFormat

plugins {
kotlin("multiplatform") version "1.5.10"
id("org.jetbrains.compose") version "0.0.0-web-dev-14"
id("org.jetbrains.compose") version "0.5.0-build221"
}

version = "1.0-SNAPSHOT"
2 changes: 1 addition & 1 deletion examples/web-getting-started/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
kotlin("multiplatform") version "1.5.10"
id("org.jetbrains.compose") version "0.0.0-web-dev-14"
id("org.jetbrains.compose") version "0.5.0-build221"
}

repositories {
2 changes: 1 addition & 1 deletion examples/web-with-react/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
kotlin("multiplatform") version "1.5.10"
id("org.jetbrains.compose") version "0.0.0-web-dev-14"
id("org.jetbrains.compose") version "0.5.0-build221"
}

repositories {
2 changes: 1 addition & 1 deletion examples/web_landing/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
kotlin("multiplatform") version "1.5.10"
id("org.jetbrains.compose") version "0.0.0-web-dev-14"
id("org.jetbrains.compose") version "0.5.0-build221"
}

repositories {
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ fun Layout(content: @Composable () -> Unit) {
flexDirection(FlexDirection.Column)
height(100.percent)
margin(0.px)
property("box-sizing", "border-box".asStylePropertyValue())
property("box-sizing", "border-box")
}
}) {
content()
@@ -28,8 +28,8 @@ fun Layout(content: @Composable () -> Unit) {
fun MainContentLayout(content: @Composable () -> Unit) {
Main({
style {
property("flex", value("1 0 auto"))
property("box-sizing", "border-box".asStylePropertyValue())
property("flex", "1 0 auto")
property("box-sizing", "border-box")
}
}) {
content()
Original file line number Diff line number Diff line change
@@ -87,7 +87,7 @@ private fun CardWithList(card: CardWithListPresentation) {
card.list.forEachIndexed { ix, it ->
Li({
style {
property("padding-top", value(24.px))
property("padding-top", 24.px)
}
}) { Text(it) }
}
Original file line number Diff line number Diff line change
@@ -34,9 +34,9 @@ object SwitcherStylesheet : StyleSheet(AppStylesheet) {
display(DisplayStyle.InlineBlock)
property("width", SwitcherVariables.labelWidth.value(56.px))
property("padding", SwitcherVariables.labelPadding.value(10.px))
property("transition", value("all 0.3s"))
property("text-align", value("center"))
property("box-sizing", value("border-box"))
property("transition", "all 0.3s")
property("text-align", "center")
property("box-sizing", "border-box")

border {
style(LineStyle.Solid)
Original file line number Diff line number Diff line change
@@ -237,7 +237,7 @@ private fun TitledCodeSample(title: String, code: String) {
style {
backgroundColor(Color.RGBA(39, 40, 44, 0.05))
borderRadius(8.px, 8.px, 8.px)
property("padding", "12px 16px".asStylePropertyValue())
property("padding", "12px 16px")
}
}) {
FormattedCodeSnippet(code = code)
@@ -248,16 +248,16 @@ private fun TitledCodeSample(title: String, code: String) {
fun FormattedCodeSnippet(code: String, language: String = "kotlin") {
Pre({
style {
property("max-height", 25.em.asStylePropertyValue())
property("overflow", "auto".asStylePropertyValue())
property("max-height", 25.em)
property("overflow", "auto")
height(auto)
}
}) {
Code({
classes("language-$language", "hljs")
style {
property("font-family", "'JetBrains Mono', monospace".asStylePropertyValue())
property("tab-size", 4.asStylePropertyValue())
property("font-family", "'JetBrains Mono', monospace")
property("tab-size", 4)
fontSize(10.pt)
backgroundColor(Color("transparent"))
}
Original file line number Diff line number Diff line change
@@ -13,13 +13,13 @@ fun PageFooter() {
Footer({
style {
flexShrink(0)
property("box-sizing", value("border-box"))
property("box-sizing", "border-box")
}
}) {
Section({
classes(WtSections.wtSectionBgGrayDark)
style {
property("padding", value("24px 0"))
property("padding", "24px 0")
}
}) {
Div({ classes(WtContainer.wtContainer) }) {
@@ -61,7 +61,7 @@ private fun CopyrightInFooter() {
style {
justifyContent(JustifyContent.SpaceEvenly)
flexWrap(FlexWrap.Wrap)
property("padding", value("0px 12px"))
property("padding", "0px 12px")
}
}) {
Span({
Original file line number Diff line number Diff line change
@@ -50,9 +50,9 @@ private fun LanguageButton() {
onClick { window.alert("Oops! This feature is yet to be implemented") }
}) {
Img(src = "ic_lang.svg", attrs = { style {
property("padding-left", 8.px.asStylePropertyValue())
property("padding-right", 8.px.asStylePropertyValue())
}}) {}
property("padding-left", 8.px)
property("padding-right", 8.px)
}})
Text("English")
}
}
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ fun Intro() {
alignSelf(AlignSelf.Start)
}
}) {
Img(src = "i1.svg", attrs = { classes(AppStylesheet.composeLogo) }) {}
Img(src = "i1.svg", attrs = { classes(AppStylesheet.composeLogo) })
}

Div({
@@ -41,7 +41,7 @@ fun Intro() {
classes(WtTexts.wtHero)
style {
display(DisplayStyle.InlineBlock)
property("white-space", "nowrap".asStylePropertyValue())
property("white-space", "nowrap")
}
}) {
Text("Web")
@@ -124,12 +124,12 @@ private fun IntroCodeSample() {
marginTop(24.px)
backgroundColor(Color.RGBA(39, 40, 44, 0.05))
borderRadius(8.px)
property("font-family", "'JetBrains Mono', monospace".asStylePropertyValue())
property("font-family", "'JetBrains Mono', monospace")
}
}) {
Div({
style {
property("padding", "12px 16px".asStylePropertyValue())
property("padding", "12px 16px")
}
}) {
FormattedCodeSnippet(
@@ -162,7 +162,7 @@ private fun IntroCodeSample() {
private fun IntroCodeSampleResult() {
Div({
style {
property("padding", "12px 16px".asStylePropertyValue())
property("padding", "12px 16px")
display(DisplayStyle.Flex)
flexDirection(FlexDirection.Row)
alignItems(AlignItems.Center)
@@ -171,7 +171,7 @@ private fun IntroCodeSampleResult() {
Span({
classes(WtTexts.wtText2)
style {
property("margin-right", 8.px.asStylePropertyValue())
property("margin-right", 8.px)
}
}) {
Text("Result:")
@@ -203,7 +203,7 @@ private fun ComposeWebStatusMessage() {
width(24.px)
height(24.px)
}
}) {}
})
}

Div({
Original file line number Diff line number Diff line change
@@ -26,14 +26,14 @@ object AppCSSVariables : CSSVariables {

object AppStylesheet : StyleSheet() {
val composeLogo by style {
property("max-width", value(100.percent))
property("max-width", 100.percent)
}

val composeTitleTag by style {
property("padding", value("5px 12px"))
property("letter-spacing", value("normal"))
property("font-weight", value(400))
property("line-height", value(24.px))
property("padding", "5px 12px")
property("letter-spacing", "normal")
property("font-weight", 400)
property("line-height", 24.px)

position(Position.Relative)
top((-32).px)
@@ -54,7 +54,7 @@ object AppStylesheet : StyleSheet() {
"label, a, button" style {
property(
"font-family",
value("system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Droid Sans,Helvetica Neue,Arial,sans-serif")
"system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Droid Sans,Helvetica Neue,Arial,sans-serif"
)
}

@@ -83,13 +83,13 @@ object AppStylesheet : StyleSheet() {

property(
"flex-basis",
value("calc(8.33333%*${AppCSSVariables.wtColCount.value()} - ${AppCSSVariables.wtHorizontalLayoutGutter.value()}*2)")
"calc(8.33333%*${AppCSSVariables.wtColCount.value()} - ${AppCSSVariables.wtHorizontalLayoutGutter.value()}*2)"
)
property(
"max-width",
value("calc(8.33333%*${AppCSSVariables.wtColCount.value()} - ${AppCSSVariables.wtHorizontalLayoutGutter.value()}*2)")
"calc(8.33333%*${AppCSSVariables.wtColCount.value()} - ${AppCSSVariables.wtHorizontalLayoutGutter.value()}*2)"
)
property("box-sizing", value("border-box"))
property("box-sizing", "border-box")
}
}
}
Original file line number Diff line number Diff line change
@@ -7,8 +7,8 @@ object WtCards : StyleSheet(AppStylesheet) {
display(DisplayStyle.Flex)
flexDirection(FlexDirection.Column)
border(1.px, LineStyle.Solid)
property("min-height", value(0))
property("box-sizing", value("border-box"))
property("min-height", 0)
property("box-sizing", "border-box")
}

val wtCardThemeLight by style {
@@ -25,11 +25,11 @@ object WtCards : StyleSheet(AppStylesheet) {

val wtCardSection by style {
position(Position.Relative)
property("overflow", value("auto"))
property("flex", value("1 1 auto"))
property("min-height", value(0))
property("box-sizing", value("border-box"))
property("padding", value("24px 32px"))
property("overflow", "auto")
property("flex", "1 1 auto")
property("min-height", 0)
property("box-sizing", "border-box")
property("padding", "24px 32px")

media(maxWidth(640.px)) {
self style { padding(16.px) }
@@ -44,6 +44,6 @@ object WtCards : StyleSheet(AppStylesheet) {

val wtVerticalFlexGrow by style {
flexGrow(1)
property("max-width", value(100.percent))
property("max-width", 100.percent)
}
}
Original file line number Diff line number Diff line change
@@ -110,19 +110,19 @@ object WtCols : StyleSheet(AppStylesheet) {
forMaxWidth(640.px) {
AppCSSVariables.wtColCount(0)
flexGrow(1)
property("max-width", value(100.percent))
property("max-width", 100.percent)
}
}

val wtColAutoFill by style {
AppCSSVariables.wtColCount(0)
flexGrow(1)
property("max-width", value(100.percent))
property("max-width", 100.percent)
}

val wtColInline by style {
AppCSSVariables.wtColCount(0)
property("max-width", value(100.percent))
property("flex-basis", value("auto"))
property("max-width", 100.percent)
property("flex-basis", "auto")
}
}
Original file line number Diff line number Diff line change
@@ -4,34 +4,34 @@ import org.jetbrains.compose.web.css.*

object WtContainer : StyleSheet(AppStylesheet) {
val wtContainer by style {
property("margin-left", value("auto"))
property("margin-right", value("auto"))
property("box-sizing", value("border-box"))
property("padding-left", value(22.px))
property("padding-right", value(22.px))
property("max-width", value(1276.px))
property("margin-left", "auto")
property("margin-right", "auto")
property("box-sizing", "border-box")
property("padding-left", 22.px)
property("padding-right", 22.px)
property("max-width", 1276.px)

media(maxWidth(640.px)) {
self style {
property("max-width", value(100.percent))
property("padding-left", value(16.px))
property("padding-right", value(16.px))
property("max-width", 100.percent)
property("padding-left", 16.px)
property("padding-right", 16.px)
}
}

media(maxWidth(1276.px)) {
self style {
property("max-width", value(996.px))
property("padding-left", value(22.px))
property("padding-right", value(22.px))
property("max-width", 996.px)
property("padding-left", 22.px)
property("padding-right", 22.px)
}
}

media(maxWidth(1000.px)) {
self style {
property("max-width", value(100.percent))
property("padding-left", value(22.px))
property("padding-right", value(22.px))
property("max-width", 100.percent)
property("padding-left", 22.px)
property("padding-right", 22.px)
}
}
}
Original file line number Diff line number Diff line change
@@ -7,15 +7,15 @@ object WtOffsets : StyleSheet(AppStylesheet) {
marginTop(96.px)
property(
"margin-top",
value("calc(4*${AppCSSVariables.wtOffsetTopUnit.value(24.px)})")
"calc(4*${AppCSSVariables.wtOffsetTopUnit.value(24.px)})"
)
}

val wtTopOffset24 by style {
marginTop(24.px)
property(
"margin-top",
value("calc(1*${AppCSSVariables.wtOffsetTopUnit.value(24.px)})")
"calc(1*${AppCSSVariables.wtOffsetTopUnit.value(24.px)})"
)
}

12 changes: 6 additions & 6 deletions examples/web_landing/src/jsMain/kotlin/com/sample/style/WtRow.kt
Original file line number Diff line number Diff line change
@@ -3,23 +3,23 @@ package com.sample.style
import org.jetbrains.compose.web.css.*

object WtRows : StyleSheet(AppStylesheet) {

val wtRow by style {
AppCSSVariables.wtHorizontalLayoutGutter(0.px)
display(DisplayStyle.Flex)
flexWrap(FlexWrap.Wrap)

property(
"margin-right",
value("calc(-1*${AppCSSVariables.wtHorizontalLayoutGutter.value()})")
"calc(-1*${AppCSSVariables.wtHorizontalLayoutGutter.value()})"
)
property(
"margin-left",
value("calc(-1*${AppCSSVariables.wtHorizontalLayoutGutter.value()})")
"calc(-1*${AppCSSVariables.wtHorizontalLayoutGutter.value()})"
)
property("box-sizing", StylePropertyValue("border-box"))
property("box-sizing", "border-box")
}

val wtRowSizeM by style {
AppCSSVariables.wtHorizontalLayoutGutter(16.px)

@@ -33,7 +33,7 @@ object WtRows : StyleSheet(AppStylesheet) {
val wtRowSizeXs by style {
AppCSSVariables.wtHorizontalLayoutGutter(6.px)
}

val wtRowSmAlignItemsCenter by style {
self style {
alignItems(AlignItems.Center)
Original file line number Diff line number Diff line change
@@ -5,14 +5,12 @@ import org.jetbrains.compose.web.css.*
object WtSections : StyleSheet(AppStylesheet) {

val wtSection by style {
property("box-sizing", value("border-box"))
property("padding-bottom", value(96.px))
property("padding-top", value(1.px))
property("box-sizing", "border-box")
property("padding-bottom", 96.px)
property("padding-top", 1.px)
property(
propertyName = "padding-bottom",
value = value(
"calc(4*${AppCSSVariables.wtOffsetTopUnit.value(24.px)})"
)
value = "calc(4*${AppCSSVariables.wtOffsetTopUnit.value(24.px)})"
)
backgroundColor("#fff")
}
86 changes: 43 additions & 43 deletions examples/web_landing/src/jsMain/kotlin/com/sample/style/WtText.kt
Original file line number Diff line number Diff line change
@@ -9,9 +9,9 @@ object WtTexts : StyleSheet(AppStylesheet) {
color("#27282c")
fontSize(60.px)
property("font-size", AppCSSVariables.wtHeroFontSize.value(60.px))
property("letter-spacing", value((-1.5).px))
property("font-weight", value(900))
property("line-height", value(64.px))
property("letter-spacing", (-1.5).px)
property("font-weight", 900)
property("line-height", 64.px)
property("line-height", AppCSSVariables.wtHeroLineHeight.value(64.px))

media(maxWidth(640.px)) {
@@ -23,17 +23,17 @@ object WtTexts : StyleSheet(AppStylesheet) {

property(
"font-family",
value("Gotham SSm A,Gotham SSm B,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Droid Sans,Helvetica Neue,Arial,sans-serif")
"Gotham SSm A,Gotham SSm B,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Droid Sans,Helvetica Neue,Arial,sans-serif"
)
}

val wtSubtitle2 by style {
color("#27282c")
fontSize(28.px)
property("font-size", AppCSSVariables.wtSubtitle2FontSize.value(28.px))
property("letter-spacing", value("normal"))
property("font-weight", value(300))
property("line-height", value(40.px))
property("letter-spacing", "normal")
property("font-weight", 300)
property("line-height", 40.px)
property("line-height", AppCSSVariables.wtSubtitle2LineHeight.value(40.px))

media(maxWidth(640.px)) {
@@ -45,20 +45,20 @@ object WtTexts : StyleSheet(AppStylesheet) {

property(
"font-family",
value("Gotham SSm A,Gotham SSm B,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Droid Sans,Helvetica Neue,Arial,sans-serif")
"Gotham SSm A,Gotham SSm B,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Droid Sans,Helvetica Neue,Arial,sans-serif"
)
}

val wtText1 by style {
color(Color.RGBA(39, 40, 44, .7))
fontSize(18.px)
property("letter-spacing", value("normal"))
property("font-weight", value(400))
property("line-height", value(28.px))
property("letter-spacing", "normal")
property("font-weight", 400)
property("line-height", 28.px)

property(
"font-family",
value("system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Droid Sans,Helvetica Neue,Arial,sans-serif")
"system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Droid Sans,Helvetica Neue,Arial,sans-serif"
)
}

@@ -69,26 +69,26 @@ object WtTexts : StyleSheet(AppStylesheet) {
val wtText2 by style {
color(Color.RGBA(39, 40, 44, .7))
fontSize(15.px)
property("letter-spacing", value("normal"))
property("font-weight", value(400))
property("line-height", value(24.px))
property("letter-spacing", "normal")
property("font-weight", 400)
property("line-height", 24.px)

property(
"font-family",
value("system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Droid Sans,Helvetica Neue,Arial,sans-serif")
"system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Droid Sans,Helvetica Neue,Arial,sans-serif"
)
}

val wtText3 by style {
color(Color.RGBA(39, 40, 44, .7))
fontSize(12.px)
property("letter-spacing", value("normal"))
property("font-weight", value(400))
property("line-height", value(16.px))
property("letter-spacing", "normal")
property("font-weight", 400)
property("line-height", 16.px)

property(
"font-family",
value("system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Droid Sans,Helvetica Neue,Arial,sans-serif")
"system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Droid Sans,Helvetica Neue,Arial,sans-serif"
)
}

@@ -105,23 +105,23 @@ object WtTexts : StyleSheet(AppStylesheet) {
}

val wtLink by style {
property("border-bottom", value("1px solid transparent"))
property("text-decoration", value("none"))
property("border-bottom", "1px solid transparent")
property("text-decoration", "none")
color("#167dff")

hover(self) style {
property("border-bottom-color", value("#167dff"))
property("border-bottom-color", "#167dff")
}
}

val wtH2 by style {
color("#27282c")
fontSize(31.px)
property("font-size", AppCSSVariables.wtH2FontSize.value(31.px))
property("letter-spacing", value((-.5).px))
property("font-weight", value(700))
property("line-height", value(40.px))
property("line-height", AppCSSVariables.wtH2LineHeight.value(40.px))
property("letter-spacing", (-.5).px)
property("font-weight", 700)
property("line-height", 40.px)
property("line-height", 40.px)

media(maxWidth(640.px)) {
self style {
@@ -132,7 +132,7 @@ object WtTexts : StyleSheet(AppStylesheet) {

property(
"font-family",
value("Gotham SSm A,Gotham SSm B,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Droid Sans,Helvetica Neue,Arial,sans-serif")
"Gotham SSm A,Gotham SSm B,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Droid Sans,Helvetica Neue,Arial,sans-serif"
)
}

@@ -144,14 +144,14 @@ object WtTexts : StyleSheet(AppStylesheet) {
color("#27282c")
fontSize(21.px)
property("font-size", AppCSSVariables.wtH3FontSize.value(20.px))
property("letter-spacing", value("normal"))
property("font-weight", value(700))
property("line-height", value(28.px))
property("letter-spacing", "normal")
property("font-weight", 700)
property("line-height", 28.px)
property("line-height", AppCSSVariables.wtH3LineHeight.value(28.px))

property(
"font-family",
value("system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Droid Sans,Helvetica Neue,Arial,sans-serif")
"system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Droid Sans,Helvetica Neue,Arial,sans-serif"
)
}

@@ -164,12 +164,12 @@ object WtTexts : StyleSheet(AppStylesheet) {
backgroundColor("#167dff")
fontSize(15.px)
display(DisplayStyle.InlineBlock)
property("text-decoration", value("none"))
property("border-radius", value("24px"))
property("padding", value("12px 32px"))
property("line-height", value(24.px))
property("font-weight", value(400))
property("width", value("fit-content"))
property("text-decoration", "none")
property("border-radius", "24px")
property("padding", "12px 32px")
property("line-height", 24.px)
property("font-weight", 400)
property("width", "fit-content")

hover(self) style {
backgroundColor(Color.RGBA(22, 125, 255, .8))
@@ -183,7 +183,7 @@ object WtTexts : StyleSheet(AppStylesheet) {
backgroundColor(Color("transparent"))
border(0.px)

property("outline", value("none"))
property("outline", "none")

hover(self) style {
backgroundColor(Color.RGBA(255, 255, 255, 0.1))
@@ -200,21 +200,21 @@ object WtTexts : StyleSheet(AppStylesheet) {
}

val wtSocialButtonItem by style {
property("margin-right", value(16.px))
property("margin-right", 16.px)
marginLeft(16.px)
padding(12.px)
backgroundColor("transparent")
display(DisplayStyle.LegacyInlineFlex)

hover(self) style {
backgroundColor(Color.RGBA(255, 255, 255, 0.1))
property("border-radius", value("24px"))
property("border-radius", "24px")
}

media(maxWidth(640.px)) {
self style {
property("margin-right", value(8.px))
property("margin-left", value(8.px))
property("margin-right", 8.px)
property("margin-left", 8.px)
}
}
}

0 comments on commit 492a522

Please sign in to comment.