update error content
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<resources>
|
||||
<string name="error_title">Произошла ошибка</string>
|
||||
<string name="ok">Понятно</string>
|
||||
<string name="retry">Повторить</string>
|
||||
</resources>
|
||||
|
||||
@@ -3,6 +3,7 @@ package ru.shadowsparky.ui.components
|
||||
import androiddev.libs.ui.generated.resources.Res
|
||||
import androiddev.libs.ui.generated.resources.error_title
|
||||
import androiddev.libs.ui.generated.resources.ok
|
||||
import androiddev.libs.ui.generated.resources.retry
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
@@ -25,9 +26,10 @@ fun ErrorContent(
|
||||
message: String,
|
||||
modifier: Modifier = Modifier,
|
||||
buttonModifier: Modifier = Modifier,
|
||||
buttonText: String = stringResource(Res.string.ok),
|
||||
retry: Boolean = true,
|
||||
onClick: () -> Unit
|
||||
) {
|
||||
val buttonTextRes = if (retry) Res.string.retry else Res.string.ok
|
||||
Column(
|
||||
verticalArrangement = Arrangement.Center,
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
@@ -35,10 +37,10 @@ fun ErrorContent(
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(Res.string.error_title),
|
||||
style = MaterialTheme.typography.titleMedium,
|
||||
style = MaterialTheme.typography.titleLarge,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
Spacer(Modifier.height(2.dp))
|
||||
Spacer(Modifier.height(4.dp))
|
||||
Text(
|
||||
text = message,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
@@ -47,7 +49,7 @@ fun ErrorContent(
|
||||
Spacer(Modifier.height(8.dp))
|
||||
Button(modifier = buttonModifier, onClick = { onClick() }) {
|
||||
Text(
|
||||
text = buttonText,
|
||||
text = stringResource(buttonTextRes),
|
||||
style = MaterialTheme.typography.bodyMedium
|
||||
)
|
||||
}
|
||||
@@ -57,7 +59,6 @@ fun ErrorContent(
|
||||
@Composable
|
||||
fun ErrorAlert(
|
||||
message: String,
|
||||
buttonText: String = stringResource(Res.string.ok),
|
||||
onClick: () -> Unit,
|
||||
onSkip: () -> Unit = onClick
|
||||
) {
|
||||
@@ -66,7 +67,7 @@ fun ErrorAlert(
|
||||
message,
|
||||
Modifier,
|
||||
Modifier.fillMaxWidth(),
|
||||
buttonText,
|
||||
false,
|
||||
onClick
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user