Skip to content

Commit 46d5723

Browse files
committed
Add stories
1 parent 1cb489c commit 46d5723

File tree

12 files changed

+734
-0
lines changed

12 files changed

+734
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import org.jetbrains.compose.storytale.story
2+
import org.jetbrains.kotlinconf.ui.components.Button
3+
import org.jetbrains.kotlinconf.ui.theme.KotlinConfTheme
4+
import androidx.compose.runtime.Composable
5+
import androidx.compose.ui.Modifier
6+
7+
val `Primary Button` by story {
8+
KotlinConfTheme {
9+
Button(
10+
label = "Primary Button",
11+
onClick = {},
12+
primary = true
13+
)
14+
}
15+
}
16+
17+
val `Secondary Button` by story {
18+
KotlinConfTheme {
19+
Button(
20+
label = "Secondary Button",
21+
onClick = {},
22+
primary = false
23+
)
24+
}
25+
}
26+
27+
val `Disabled Button` by story {
28+
val enabled by parameter(false)
29+
30+
KotlinConfTheme {
31+
Button(
32+
label = "Disabled Button",
33+
onClick = {},
34+
enabled = enabled
35+
)
36+
}
37+
}
38+
39+
val `Button with custom label` by story {
40+
val label by parameter("Custom Label")
41+
42+
KotlinConfTheme {
43+
Button(
44+
label = label,
45+
onClick = {}
46+
)
47+
}
48+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import org.jetbrains.compose.storytale.story
2+
import org.jetbrains.kotlinconf.ui.components.CardTag
3+
import org.jetbrains.kotlinconf.ui.theme.KotlinConfTheme
4+
import androidx.compose.runtime.mutableStateOf
5+
import androidx.compose.runtime.remember
6+
import androidx.compose.runtime.getValue
7+
import androidx.compose.runtime.setValue
8+
9+
val `Unselected CardTag` by story {
10+
KotlinConfTheme {
11+
CardTag(
12+
label = "Unselected Tag",
13+
selected = false
14+
)
15+
}
16+
}
17+
18+
val `Selected CardTag` by story {
19+
KotlinConfTheme {
20+
CardTag(
21+
label = "Selected Tag",
22+
selected = true
23+
)
24+
}
25+
}
26+
27+
val `Interactive CardTag` by story {
28+
KotlinConfTheme {
29+
var selected by remember { mutableStateOf(false) }
30+
CardTag(
31+
label = if (selected) "Selected Tag (click to unselect)" else "Unselected Tag (click to select)",
32+
selected = selected
33+
)
34+
// Note: CardTag doesn't have a click handler, so this is just for demonstration
35+
}
36+
}
37+
38+
val `CardTag with Parameters` by story {
39+
val label by parameter("Customizable Tag")
40+
val selected by parameter(false)
41+
42+
KotlinConfTheme {
43+
CardTag(
44+
label = label,
45+
selected = selected
46+
)
47+
}
48+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import org.jetbrains.compose.storytale.story
2+
import org.jetbrains.kotlinconf.ui.components.Divider
3+
import org.jetbrains.kotlinconf.ui.theme.KotlinConfTheme
4+
import androidx.compose.ui.graphics.Color
5+
import androidx.compose.ui.unit.dp
6+
7+
val `Default Divider` by story {
8+
KotlinConfTheme {
9+
Divider(
10+
thickness = 1.dp,
11+
color = KotlinConfTheme.colors.strokeHalf
12+
)
13+
}
14+
}
15+
16+
val `Thick Divider` by story {
17+
KotlinConfTheme {
18+
Divider(
19+
thickness = 4.dp,
20+
color = KotlinConfTheme.colors.strokeHalf
21+
)
22+
}
23+
}
24+
25+
val `Custom Color Divider` by story {
26+
KotlinConfTheme {
27+
Divider(
28+
thickness = 2.dp,
29+
color = KotlinConfTheme.colors.primaryBackground
30+
)
31+
}
32+
}
33+
34+
val `Divider with Parameters` by story {
35+
val thickness by parameter(2.dp)
36+
val useCustomColor by parameter(false)
37+
38+
KotlinConfTheme {
39+
Divider(
40+
thickness = thickness,
41+
color = if (useCustomColor) KotlinConfTheme.colors.primaryBackground else KotlinConfTheme.colors.strokeHalf
42+
)
43+
}
44+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import org.jetbrains.compose.storytale.story
2+
import org.jetbrains.kotlinconf.ui.components.NewsCard
3+
import org.jetbrains.kotlinconf.ui.theme.KotlinConfTheme
4+
import androidx.compose.ui.Modifier
5+
6+
val `News Card with Photo` by story {
7+
KotlinConfTheme {
8+
NewsCard(
9+
title = "Kotlin 2.0 Released",
10+
date = "May 23, 2023",
11+
photoUrl = "https://kotlinlang.org/assets/images/open-graph/kotlin-logo.png",
12+
onClick = {}
13+
)
14+
}
15+
}
16+
17+
val `News Card without Photo` by story {
18+
KotlinConfTheme {
19+
NewsCard(
20+
title = "Important Conference Update",
21+
date = "May 22, 2023",
22+
photoUrl = null,
23+
onClick = {}
24+
)
25+
}
26+
}
27+
28+
val `News Card with Long Title` by story {
29+
KotlinConfTheme {
30+
NewsCard(
31+
title = "This is a very long news title that might wrap to multiple lines depending on the available width",
32+
date = "May 21, 2023",
33+
photoUrl = "https://kotlinlang.org/assets/images/open-graph/kotlin-logo.png",
34+
onClick = {}
35+
)
36+
}
37+
}
38+
39+
val `News Card with Parameters` by story {
40+
val title by parameter("Customizable News Title")
41+
val date by parameter("May 20, 2023")
42+
val hasPhoto by parameter(true)
43+
44+
KotlinConfTheme {
45+
NewsCard(
46+
title = title,
47+
date = date,
48+
photoUrl = if (hasPhoto) "https://kotlinlang.org/assets/images/open-graph/kotlin-logo.png" else null,
49+
onClick = {}
50+
)
51+
}
52+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import org.jetbrains.compose.storytale.story
2+
import org.jetbrains.kotlinconf.ui.components.NowButton
3+
import org.jetbrains.kotlinconf.ui.components.NowLabel
4+
import org.jetbrains.kotlinconf.ui.components.NowButtonState
5+
import org.jetbrains.kotlinconf.ui.theme.KotlinConfTheme
6+
import androidx.compose.ui.Modifier
7+
8+
val `Now Label` by story {
9+
KotlinConfTheme {
10+
NowLabel()
11+
}
12+
}
13+
14+
val `Now Button - Before` by story {
15+
KotlinConfTheme {
16+
NowButton(
17+
time = NowButtonState.Before,
18+
onClick = {}
19+
)
20+
}
21+
}
22+
23+
val `Now Button - Current` by story {
24+
KotlinConfTheme {
25+
NowButton(
26+
time = NowButtonState.Current,
27+
onClick = {}
28+
)
29+
}
30+
}
31+
32+
val `Now Button - After` by story {
33+
KotlinConfTheme {
34+
NowButton(
35+
time = NowButtonState.After,
36+
onClick = {}
37+
)
38+
}
39+
}
40+
41+
val `Now Button with Parameters` by story {
42+
val state by parameter(NowButtonState.Before)
43+
val enabled by parameter(true)
44+
45+
KotlinConfTheme {
46+
NowButton(
47+
time = state,
48+
onClick = {},
49+
enabled = enabled
50+
)
51+
}
52+
}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
import org.jetbrains.compose.storytale.story
2+
import org.jetbrains.kotlinconf.ui.components.PageTitle
3+
import org.jetbrains.kotlinconf.ui.theme.KotlinConfTheme
4+
import androidx.compose.runtime.mutableStateOf
5+
import androidx.compose.runtime.remember
6+
import androidx.compose.runtime.getValue
7+
import androidx.compose.runtime.setValue
8+
9+
val `Regular Talk PageTitle` by story {
10+
KotlinConfTheme {
11+
var bookmarked by remember { mutableStateOf(false) }
12+
PageTitle(
13+
time = "May 21, 9:00 - 9:40",
14+
title = "A Wonderful Server-side Kotlin Talk",
15+
tags = setOf("Regular talk", "Beginner", "Server-side"),
16+
bookmarked = bookmarked,
17+
lightning = false,
18+
onBookmark = { bookmarked = it }
19+
)
20+
}
21+
}
22+
23+
val `Lightning Talk PageTitle` by story {
24+
KotlinConfTheme {
25+
var bookmarked by remember { mutableStateOf(false) }
26+
PageTitle(
27+
time = "May 23, 13:00 - 13:20",
28+
title = "My Incredible Talk About Kotlin Multiplatform",
29+
tags = setOf("Lightning talk", "Intermediate", "Libraries"),
30+
bookmarked = bookmarked,
31+
lightning = true,
32+
onBookmark = { bookmarked = it }
33+
)
34+
}
35+
}
36+
37+
val `Bookmarked PageTitle` by story {
38+
KotlinConfTheme {
39+
var bookmarked by remember { mutableStateOf(true) }
40+
PageTitle(
41+
time = "May 22, 11:00 - 11:40",
42+
title = "Advanced Kotlin Coroutines",
43+
tags = setOf("Regular talk", "Advanced", "Concurrency"),
44+
bookmarked = bookmarked,
45+
lightning = false,
46+
onBookmark = { bookmarked = it }
47+
)
48+
}
49+
}
50+
51+
val `Education PageTitle` by story {
52+
KotlinConfTheme {
53+
var bookmarked by remember { mutableStateOf(false) }
54+
PageTitle(
55+
time = "May 22, 14:00 - 15:30",
56+
title = "Introduction to Kotlin Multiplatform",
57+
tags = setOf("Education", "Beginner", "Multiplatform"),
58+
bookmarked = bookmarked,
59+
lightning = false,
60+
onBookmark = { bookmarked = it }
61+
)
62+
}
63+
}
64+
65+
val `Codelab PageTitle` by story {
66+
KotlinConfTheme {
67+
var bookmarked by remember { mutableStateOf(false) }
68+
PageTitle(
69+
time = "May 23, 10:00 - 11:30",
70+
title = "Building Your First Compose Multiplatform App",
71+
tags = setOf("Codelab", "Intermediate", "Compose"),
72+
bookmarked = bookmarked,
73+
lightning = false,
74+
onBookmark = { bookmarked = it }
75+
)
76+
}
77+
}
78+
79+
val `PageTitle with Parameters` by story {
80+
val title by parameter("Customizable Title")
81+
val time by parameter("May 22, 10:00 - 10:40")
82+
val isLightning by parameter(false)
83+
val initialBookmarked by parameter(false)
84+
85+
KotlinConfTheme {
86+
var bookmarked by remember { mutableStateOf(initialBookmarked) }
87+
PageTitle(
88+
time = time,
89+
title = title,
90+
tags = setOf("Regular talk", "Intermediate", "Kotlin"),
91+
bookmarked = bookmarked,
92+
lightning = isLightning,
93+
onBookmark = { bookmarked = it }
94+
)
95+
}
96+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import org.jetbrains.compose.storytale.story
2+
import org.jetbrains.kotlinconf.ui.components.PartnerCard
3+
import org.jetbrains.kotlinconf.ui.theme.KotlinConfTheme
4+
import kotlinconfapp.ui_components.generated.resources.UiRes
5+
import kotlinconfapp.ui_components.generated.resources.kodee_large_positive_light
6+
7+
val `Partner Card` by story {
8+
KotlinConfTheme {
9+
PartnerCard(
10+
name = "Kodee",
11+
logo = UiRes.drawable.kodee_large_positive_light,
12+
onClick = {}
13+
)
14+
}
15+
}
16+
17+
val `Partner Card with Parameters` by story {
18+
val name by parameter("Partner Name")
19+
20+
KotlinConfTheme {
21+
PartnerCard(
22+
name = name,
23+
logo = UiRes.drawable.kodee_large_positive_light,
24+
onClick = {}
25+
)
26+
}
27+
}

0 commit comments

Comments
 (0)