File tree 4 files changed +29
-7
lines changed
4 files changed +29
-7
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ import org.jetbrains.compose.web.renderComposableInBody
25
25
import pages.CatFactPage
26
26
import pages.HelloWorldPage
27
27
import pages.HomePage
28
+ import pages.SwitchesPage
28
29
29
30
fun main () {
30
31
val client =
@@ -68,6 +69,9 @@ fun main() {
68
69
route(" /" ) {
69
70
HomePage ()
70
71
}
72
+ route(" /switches" ) {
73
+ SwitchesPage ()
74
+ }
71
75
route(" /hello-world" ) {
72
76
HelloWorldPage ()
73
77
}
Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ import org.jetbrains.compose.web.dom.Text
21
21
internal class SwitchStyles (
22
22
invertedColors : Boolean ,
23
23
) : StyleSheet() {
24
+ val animationDuration = 0.3 .s
25
+
24
26
val switch by style {
25
27
position(Position .Relative )
26
28
display(DisplayStyle .InlineBlock )
@@ -53,7 +55,7 @@ internal class SwitchStyles(
53
55
},
54
56
)
55
57
transitions {
56
- defaultDuration( 0.4 .s)
58
+ " " { duration = animationDuration }
57
59
}
58
60
borderRadius(34 .px)
59
61
@@ -82,7 +84,7 @@ internal class SwitchStyles(
82
84
},
83
85
)
84
86
transitions {
85
- defaultDuration( 0.4 .s)
87
+ " " { duration = animationDuration }
86
88
}
87
89
borderRadius(50 .percent)
88
90
}
Original file line number Diff line number Diff line change 1
1
package pages
2
2
3
3
import androidx.compose.runtime.Composable
4
- import androidx.compose.runtime.mutableStateOf
5
4
import app.softwork.routingcompose.NavLink
6
- import components.Switch
7
5
import org.jetbrains.compose.web.dom.Text
8
6
9
7
@Composable
10
8
fun HomePage () {
11
- val state = mutableStateOf(false )
12
- Switch (" 123" , state = state)
13
- Switch (" Disabled" , disabled = true , state = state)
14
9
NavLink (" /hello-world" ) {
15
10
Text (" To Hello world!" )
16
11
}
17
12
NavLink (" /cat-fact" ) {
18
13
Text (" To Cat Facts!" )
19
14
}
15
+ NavLink (" /switches" ) {
16
+ Text (" To Switches!" )
17
+ }
20
18
}
Original file line number Diff line number Diff line change
1
+ package pages
2
+
3
+ import androidx.compose.runtime.Composable
4
+ import androidx.compose.runtime.mutableStateOf
5
+ import app.softwork.routingcompose.NavLink
6
+ import components.Switch
7
+ import org.jetbrains.compose.web.dom.Text
8
+
9
+ @Composable
10
+ fun SwitchesPage () {
11
+ val state = mutableStateOf(false )
12
+ Switch (" 123" , state = state)
13
+ Switch (" Disabled" , disabled = true , state = state)
14
+
15
+ NavLink (" /" ) {
16
+ Text (" Back to the main page" )
17
+ }
18
+ }
You can’t perform that action at this time.
0 commit comments