This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sealed class Resource<T>( | |
val data: T? | |
) { | |
class Success<T>(data: T) : Resource<T>(data) | |
class Loading<T>(data: T? = null) : Resource<T>(data) | |
class Error<T>(throwable: Throwable, data: T? = null) : Resource<T>(data) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun RegularRow( | |
modifier: Modifier = Modifier, | |
leftIcon: @Composable (RowScope.() -> Unit)? = null, | |
detail: @Composable (() -> Unit)? = null, | |
rightIcon: @Composable (RowScope.() -> Unit)? = null, | |
title: @Composable () -> Unit | |
) { | |
FoundationRow( | |
modifier = modifier.wrapContentHeight() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun TwoLine( | |
modifier: Modifier = Modifier, | |
secondary: @Composable () -> Unit, | |
primary: @Composable () -> Unit, | |
) { | |
Column(modifier = modifier) { | |
primary() | |
secondary() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun RowPreview() { | |
Column { | |
FoundationRow { | |
Text(text = "Single line") | |
} | |
Divider(modifier = Modifier.dividerSize()) | |
FoundationRow { | |
TwoLine( | |
primary = { Text(text = "Primary") }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun TwoLine( | |
modifier: Modifier = Modifier, | |
secondary: @Composable () -> Unit, | |
primary: @Composable () -> Unit, | |
) { | |
val styledPrimary = applyStyle( | |
textStyle = MaterialTheme.typography.subtitle1, | |
alpha = ContentAlpha.high, | |
content = primary |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun RegularRow( | |
modifier: Modifier = Modifier, | |
leftIcon: @Composable (RowScope.() -> Unit)? = null, | |
detail: @Composable (() -> Unit)? = null, | |
rightIcon: @Composable (RowScope.() -> Unit)? = null, | |
title: @Composable () -> Unit | |
) { | |
FoundationRow( | |
modifier = modifier.wrapContentHeight() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Group<T> { | |
/** | |
* the light mode group of colors | |
*/ | |
val light: T | |
/** | |
* the dark mode group of colors | |
*/ | |
val dark: T |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class ColorStatus( | |
val positive: Int, | |
val alert: Int, | |
val negative: Int, | |
val info: Int, | |
val positiveBackground: Int, | |
val alertBackground: Int, | |
val negativeBackground: Int, | |
val infoBackground: Int | |
) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class ColorContext( | |
val primary: Int, | |
val primaryHover: Int, | |
val primaryActive: Int, | |
val link: Int, | |
val overPrimary: Int | |
) | |
object Brand : Group<ColorContext> { | |
override val light = ColorContext( |
OlderNewer