1
1
package co.nimblehq.compose.crypto.ui.common
2
2
3
- import androidx.annotation.StringRes
4
- import androidx.compose.foundation.background
5
3
import androidx.compose.foundation.layout.*
6
4
import androidx.compose.material.*
7
5
import androidx.compose.runtime.Composable
6
+ import androidx.compose.ui.Alignment
8
7
import androidx.compose.ui.Modifier
9
- import androidx.compose.ui.graphics.Color
10
- import androidx.compose.ui.res.stringResource
11
8
import androidx.compose.ui.tooling.preview.Preview
12
9
import androidx.compose.ui.window.Dialog
13
- import co.nimblehq.compose.crypto.R
14
10
import co.nimblehq.compose.crypto.ui.theme.*
15
11
16
12
@Composable
17
13
fun AppDialogPopUp (
18
14
onDismiss : () -> Unit ,
19
15
onClick : () -> Unit ,
20
- @StringRes title : Int ,
21
- @StringRes message : Int ,
22
- @StringRes actionText : Int ,
16
+ title : String ,
17
+ message : String ,
18
+ actionText : String ,
23
19
) {
24
20
Dialog (
25
21
onDismissRequest = onDismiss
26
22
) {
27
- Column (
28
- modifier = Modifier
29
- .background(Color .White )
30
- .width(DialogWidth )
31
- ) {
32
- Text (
33
- text = stringResource(id = title),
34
- style = AppTheme .typography.h6,
35
- color = Color .Black ,
36
- modifier = Modifier .padding(top = Dp16 , start = Dp16 , end = Dp16 )
37
- )
38
- Text (
39
- text = stringResource(id = message),
40
- style = AppTheme .typography.body1,
41
- color = Color .Black ,
42
- modifier = Modifier .padding(Dp16 )
43
- )
44
- Row (
45
- horizontalArrangement = Arrangement .End ,
46
- modifier = Modifier
47
- .fillMaxWidth()
48
- .padding(bottom = Dp16 , end = Dp8 )
23
+ Surface {
24
+ Column (
25
+ modifier = Modifier .width(DialogWidth )
49
26
) {
27
+ Text (
28
+ text = title,
29
+ style = AppTheme .typography.h6,
30
+ color = AppTheme .colors.text,
31
+ modifier = Modifier .padding(top = Dp16 , start = Dp16 , end = Dp16 )
32
+ )
33
+ Text (
34
+ text = message,
35
+ style = AppTheme .typography.body1,
36
+ color = AppTheme .colors.text,
37
+ modifier = Modifier .padding(Dp16 )
38
+ )
50
39
TextButton (
51
- onClick = onClick
40
+ onClick = onClick,
41
+ modifier = Modifier
42
+ .align(Alignment .End )
43
+ .padding(bottom = Dp16 , end = Dp8 )
52
44
) {
53
45
Text (
54
- text = stringResource(id = actionText) ,
46
+ text = actionText,
55
47
style = AppTheme .styles.semiBold16,
56
- color = Color . Blue ,
48
+ color = AppTheme .colors.dialogText ,
57
49
)
58
50
}
59
51
}
@@ -69,9 +61,9 @@ fun AppDialogPopUpPreview() {
69
61
AppDialogPopUp (
70
62
onDismiss = { /* TODO*/ },
71
63
onClick = { /* TODO*/ },
72
- message = R .string.no_internet_message ,
73
- actionText = android. R .string.ok ,
74
- title = R .string.no_internet_title
64
+ message = " No internet connection was found. Please check your internet connection and try again. " ,
65
+ actionText = " OK " ,
66
+ title = " Oops! "
75
67
)
76
68
}
77
69
}
0 commit comments