generated from mpetuska/template-kmp-library
-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
MDCImageList.kt
44 lines (41 loc) · 1.22 KB
/
MDCImageList.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package showcases
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import dev.petuska.katalog.runtime.Showcase
import dev.petuska.katalog.runtime.layout.InteractiveShowcase
import dev.petuska.katalog.runtime.util.randomImageUrl
import dev.petuska.kmdc.image.list.*
import sandbox.control.BooleanControl
import sandbox.control.ChoiceControl
import sandbox.util.requireModule
private class MDCImageListVM {
var type by mutableStateOf(MDCImageListType.Standard)
var withTextProtection by mutableStateOf(false)
}
@Composable
@Showcase(id = "MDCImageList")
fun MDCImageList() = InteractiveShowcase(
viewModel = { MDCImageListVM() },
controls = {
ChoiceControl("Type", MDCImageListType.values().associateBy(MDCImageListType::name), ::type)
BooleanControl("With Text Protection", ::withTextProtection)
},
) {
requireModule("./MDCImageList.scss")
MDCImageList(
type = type,
withTextProtection = withTextProtection,
attrs = {
classes("kmdc-image-list")
}
) {
repeat(7) {
Item {
Image(src = randomImageUrl("kmdc-$it"))
Label("Image #$it")
}
}
}
}