Browse Source

Use new Color API in benchmark-core and integration-core

902_DEPRECATE_OLD_COLOR_API
Shagen Ogandzhanian 3 years ago
parent
commit
6880bbafd1
  1. 4
      web/benchmark-core/src/jsMain/kotlin/com/sample/content/CodeSnippets.kt
  2. 4
      web/benchmark-core/src/jsMain/kotlin/com/sample/content/IntroSection.kt
  3. 4
      web/benchmark-core/src/jsMain/kotlin/com/sample/style/Stylesheet.kt
  4. 27
      web/benchmark-core/src/jsMain/kotlin/com/sample/style/WtCard.kt
  5. 22
      web/benchmark-core/src/jsMain/kotlin/com/sample/style/WtText.kt
  6. 2
      web/integration-core/src/jsMain/kotlin/androidx/compose/web/sample/tests/EventsTests.kt

4
web/benchmark-core/src/jsMain/kotlin/com/sample/content/CodeSnippets.kt

@ -47,7 +47,7 @@ private val DeclareAndUseStylesheet = CodeSnippetData(
source = """
object MyStyleSheet : StyleSheet() {
val container by style { /* define a class `container` */
border(1.px, LineStyle.Solid, Color.RGB(255, 0, 0))
border(1.px, LineStyle.Solid, rgb(255, 0, 0))
}
}
@ -237,7 +237,7 @@ private fun TitledCodeSample(title: String, code: String) {
attrs = {
classes(WtOffsets.wtTopOffset24)
style {
backgroundColor(Color.RGBA(39, 40, 44, 0.05))
backgroundColor(rgba(39, 40, 44, 0.05))
borderRadius(8.px, 8.px, 8.px)
property("padding", "12px 16px")
}

4
web/benchmark-core/src/jsMain/kotlin/com/sample/content/IntroSection.kt

@ -117,7 +117,7 @@ private fun IntroCodeSample() {
Div(attrs = {
style {
marginTop(24.px)
backgroundColor(Color.RGBA(39, 40, 44, 0.05))
backgroundColor(rgba(39, 40, 44, 0.05))
borderRadius(8.px)
property("font-family", "'JetBrains Mono', monospace")
}
@ -145,7 +145,7 @@ private fun IntroCodeSample() {
style {
height(1.px)
border(width = 0.px)
backgroundColor(Color.RGBA(39, 40, 44, 0.15))
backgroundColor(rgba(39, 40, 44, 0.15))
}
})

4
web/benchmark-core/src/jsMain/kotlin/com/sample/style/Stylesheet.kt

@ -39,8 +39,8 @@ object AppStylesheet : StyleSheet() {
top((-32).px)
marginLeft(8.px)
fontSize(15.px)
backgroundColor(Color.RGBA(39, 40, 44, .05))
color(Color.RGBA(39,40,44,.7))
backgroundColor(rgba(39, 40, 44, .05))
color(rgba(39, 40, 44, .7))
borderRadius(4.px, 4.px, 4.px)
media(mediaMaxWidth(640.px)) {

27
web/benchmark-core/src/jsMain/kotlin/com/sample/style/WtCard.kt

@ -1,25 +1,6 @@
package com.sample.style
import org.jetbrains.compose.web.css.AlignItems
import org.jetbrains.compose.web.css.Color
import org.jetbrains.compose.web.css.DisplayStyle
import org.jetbrains.compose.web.css.FlexDirection
import org.jetbrains.compose.web.css.LineStyle
import org.jetbrains.compose.web.css.Position
import org.jetbrains.compose.web.css.StyleSheet
import org.jetbrains.compose.web.css.alignItems
import org.jetbrains.compose.web.css.backgroundColor
import org.jetbrains.compose.web.css.border
import org.jetbrains.compose.web.css.color
import org.jetbrains.compose.web.css.display
import org.jetbrains.compose.web.css.flexDirection
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.padding
import org.jetbrains.compose.web.css.percent
import org.jetbrains.compose.web.css.position
import org.jetbrains.compose.web.css.px
import org.jetbrains.compose.web.css.*
object WtCards : StyleSheet(AppStylesheet) {
val wtCard by style {
@ -31,14 +12,14 @@ object WtCards : StyleSheet(AppStylesheet) {
}
val wtCardThemeLight by style {
border(color = Color.RGBA(39, 40, 44, .2))
border(color = rgba(39, 40, 44, .2))
color("#27282c")
backgroundColor("white")
}
val wtCardThemeDark by style {
backgroundColor(Color.RGBA(255, 255, 255, 0.05))
color(Color.RGBA(255, 255, 255, 0.6))
backgroundColor(rgba(255, 255, 255, 0.05))
color(rgba(255, 255, 255, 0.6))
border(0.px)
}

22
web/benchmark-core/src/jsMain/kotlin/com/sample/style/WtText.kt

@ -50,7 +50,7 @@ object WtTexts : StyleSheet(AppStylesheet) {
}
val wtText1 by style {
color(Color.RGBA(39, 40, 44, .7))
color(rgba(39, 40, 44, .7))
fontSize(18.px)
property("letter-spacing", "normal")
property("font-weight", 400)
@ -63,11 +63,11 @@ object WtTexts : StyleSheet(AppStylesheet) {
}
val wtText1ThemeDark by style {
color(Color.RGBA(255, 255, 255, 0.6))
color(rgba(255, 255, 255, 0.6))
}
val wtText2 by style {
color(Color.RGBA(39, 40, 44, .7))
color(rgba(39, 40, 44, .7))
fontSize(15.px)
property("letter-spacing", "normal")
property("font-weight", 400)
@ -80,7 +80,7 @@ object WtTexts : StyleSheet(AppStylesheet) {
}
val wtText3 by style {
color(Color.RGBA(39, 40, 44, .7))
color(rgba(39, 40, 44, .7))
fontSize(12.px)
property("letter-spacing", "normal")
property("font-weight", 400)
@ -93,15 +93,15 @@ object WtTexts : StyleSheet(AppStylesheet) {
}
val wtTextPale by style {
color(Color.RGBA(255, 255, 255, 0.30))
color(rgba(255, 255, 255, 0.30))
}
val wtText2ThemeDark by style {
color(Color.RGBA(255, 255, 255, 0.6))
color(rgba(255, 255, 255, 0.6))
}
val wtText3ThemeDark by style {
color(Color.RGBA(255, 255, 255, 0.6))
color(rgba(255, 255, 255, 0.6))
}
val wtLink by style {
@ -172,7 +172,7 @@ object WtTexts : StyleSheet(AppStylesheet) {
property("width", "fit-content")
hover(self) style {
backgroundColor(Color.RGBA(22, 125, 255, .8))
backgroundColor(rgba(22, 125, 255, .8))
}
}
@ -186,7 +186,7 @@ object WtTexts : StyleSheet(AppStylesheet) {
property("outline", "none")
hover(self) style {
backgroundColor(Color.RGBA(255, 255, 255, 0.1))
backgroundColor(rgba(255, 255, 255, 0.1))
}
}
@ -195,7 +195,7 @@ object WtTexts : StyleSheet(AppStylesheet) {
backgroundColor("#27282c")
hover(self) style {
backgroundColor(Color.RGBA(39, 40, 44, .7))
backgroundColor(rgba(39, 40, 44, .7))
}
}
@ -207,7 +207,7 @@ object WtTexts : StyleSheet(AppStylesheet) {
display(DisplayStyle.LegacyInlineFlex)
hover(self) style {
backgroundColor(Color.RGBA(255, 255, 255, 0.1))
backgroundColor(rgba(255, 255, 255, 0.1))
property("border-radius", 24.px)
}

2
web/integration-core/src/jsMain/kotlin/androidx/compose/web/sample/tests/EventsTests.kt

@ -73,7 +73,7 @@ class EventsTests {
style {
property("overflow-y", "scroll")
height(200.px)
backgroundColor(Color.RGB(220, 220, 220))
backgroundColor(rgb(220, 220, 220))
}
onScroll {
state = "Scrolled"

Loading…
Cancel
Save