🚀 Smaller icons for Placeholders
* Smaller icons for ErrorPlaceholder and EmptyPlaceholder * Renamed IsEmpty, Is Error → EmptyPlaceholder, ErrorPlaceholder
This commit is contained in:
parent
3f0e9a512c
commit
b1100d5923
2 changed files with 13 additions and 12 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
package ua.acclorite.book_story.presentation.core.components.is_messages
|
package ua.acclorite.book_story.presentation.core.components.placeholder
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
|
@ -22,7 +22,7 @@ import androidx.compose.ui.unit.dp
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is Empty message. It usually placed when the list is empty.
|
* Empty placeholder. It usually is placed when the list is empty.
|
||||||
*
|
*
|
||||||
* @param modifier Modifier to be applied.
|
* @param modifier Modifier to be applied.
|
||||||
* @param message The message.
|
* @param message The message.
|
||||||
|
|
@ -31,7 +31,7 @@ import androidx.compose.ui.unit.dp
|
||||||
* @param action On click action.
|
* @param action On click action.
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun IsEmpty(
|
fun EmptyPlaceholder(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
message: String,
|
message: String,
|
||||||
icon: Painter,
|
icon: Painter,
|
||||||
|
|
@ -49,10 +49,10 @@ fun IsEmpty(
|
||||||
Icon(
|
Icon(
|
||||||
painter = icon,
|
painter = icon,
|
||||||
contentDescription = message,
|
contentDescription = message,
|
||||||
modifier = Modifier.size(190.dp),
|
modifier = Modifier.size(150.dp),
|
||||||
tint = MaterialTheme.colorScheme.primary
|
tint = MaterialTheme.colorScheme.primary
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(12.dp))
|
Spacer(modifier = Modifier.height(4.dp))
|
||||||
Text(
|
Text(
|
||||||
text = message,
|
text = message,
|
||||||
style = MaterialTheme.typography.bodyLarge,
|
style = MaterialTheme.typography.bodyLarge,
|
||||||
|
|
@ -60,7 +60,7 @@ fun IsEmpty(
|
||||||
textAlign = TextAlign.Center
|
textAlign = TextAlign.Center
|
||||||
)
|
)
|
||||||
if (actionTitle != null) {
|
if (actionTitle != null) {
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
Spacer(modifier = Modifier.height(4.dp))
|
||||||
TextButton(
|
TextButton(
|
||||||
onClick = {
|
onClick = {
|
||||||
action()
|
action()
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package ua.acclorite.book_story.presentation.core.components.is_messages
|
package ua.acclorite.book_story.presentation.core.components.placeholder
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
|
@ -21,7 +21,8 @@ import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is Empty message. It usually placed when something went wrong and you need to display large error message.
|
* Empty placeholder.
|
||||||
|
* It usually placed when something went wrong and you need to display large error message.
|
||||||
*
|
*
|
||||||
* @param modifier Modifier to be applied.
|
* @param modifier Modifier to be applied.
|
||||||
* @param errorMessage The error message.
|
* @param errorMessage The error message.
|
||||||
|
|
@ -30,7 +31,7 @@ import androidx.compose.ui.unit.dp
|
||||||
* @param action On click action.
|
* @param action On click action.
|
||||||
*/
|
*/
|
||||||
@Composable
|
@Composable
|
||||||
fun IsError(
|
fun ErrorPlaceholder(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
errorMessage: String,
|
errorMessage: String,
|
||||||
icon: Painter,
|
icon: Painter,
|
||||||
|
|
@ -48,10 +49,10 @@ fun IsError(
|
||||||
Icon(
|
Icon(
|
||||||
painter = icon,
|
painter = icon,
|
||||||
contentDescription = errorMessage,
|
contentDescription = errorMessage,
|
||||||
modifier = Modifier.size(140.dp),
|
modifier = Modifier.size(150.dp),
|
||||||
tint = MaterialTheme.colorScheme.error
|
tint = MaterialTheme.colorScheme.error
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(24.dp))
|
Spacer(modifier = Modifier.height(4.dp))
|
||||||
Text(
|
Text(
|
||||||
text = errorMessage,
|
text = errorMessage,
|
||||||
style = MaterialTheme.typography.bodyLarge,
|
style = MaterialTheme.typography.bodyLarge,
|
||||||
|
|
@ -59,7 +60,7 @@ fun IsError(
|
||||||
textAlign = TextAlign.Center
|
textAlign = TextAlign.Center
|
||||||
)
|
)
|
||||||
if (actionTitle != null) {
|
if (actionTitle != null) {
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
Spacer(modifier = Modifier.height(4.dp))
|
||||||
TextButton(
|
TextButton(
|
||||||
onClick = {
|
onClick = {
|
||||||
action()
|
action()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue