-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathInfoScreenContent.kt
More file actions
103 lines (97 loc) · 3.25 KB
/
InfoScreenContent.kt
File metadata and controls
103 lines (97 loc) · 3.25 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
package to.bitkit.ui.components
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import to.bitkit.R
import to.bitkit.ui.scaffold.AppTopBar
import to.bitkit.ui.scaffold.DrawerNavIcon
import to.bitkit.ui.scaffold.ScreenColumn
import to.bitkit.ui.theme.AppThemeSurface
import to.bitkit.ui.theme.Colors
import to.bitkit.ui.utils.withAccent
import to.bitkit.ui.utils.withAccentBoldBright
@Composable
fun InfoScreenContent(
navTitle: String,
title: AnnotatedString,
description: AnnotatedString,
image: Painter,
showCloseButton: Boolean = true,
buttonText: String,
onButtonClick: () -> Unit,
testTag: String,
) {
ScreenColumn {
AppTopBar(
titleText = navTitle,
onBackClick = null,
actions = {
if (showCloseButton) {
DrawerNavIcon()
}
},
)
Column(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp)
.testTag(testTag)
) {
VerticalSpacer(16.dp)
Display(text = title)
VerticalSpacer(8.dp)
BodyM(text = description, color = Colors.White64)
FillHeight()
Box(
contentAlignment = Alignment.Center,
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp)
.padding(top = 16.dp)
) {
Image(
painter = image,
contentDescription = null,
contentScale = ContentScale.Fit,
modifier = Modifier.size(256.dp)
)
}
FillHeight()
PrimaryButton(
text = buttonText,
onClick = onButtonClick,
modifier = Modifier.testTag("$testTag-button")
)
VerticalSpacer(16.dp)
}
}
}
@Preview(showSystemUi = true)
@Composable
private fun Preview() {
AppThemeSurface {
InfoScreenContent(
navTitle = stringResource(R.string.lightning__transfer__nav_title),
title = stringResource(R.string.lightning__savings_interrupted__title).withAccent(),
description = stringResource(R.string.lightning__savings_interrupted__text).withAccentBoldBright(),
image = painterResource(R.drawable.check),
buttonText = stringResource(R.string.common__ok),
onButtonClick = {},
testTag = "",
)
}
}