2022-03-08 11:05:03 -08:00
|
|
|
package co.electriccoin.zcash.ui.design.component
|
2021-11-08 09:31:10 -08:00
|
|
|
|
|
|
|
import androidx.compose.foundation.layout.Row
|
|
|
|
import androidx.compose.foundation.layout.Spacer
|
|
|
|
import androidx.compose.foundation.layout.padding
|
2022-02-21 06:33:40 -08:00
|
|
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
|
|
import androidx.compose.material3.MaterialTheme
|
|
|
|
import androidx.compose.material3.Surface
|
|
|
|
import androidx.compose.material3.Text
|
2021-11-08 09:31:10 -08:00
|
|
|
import androidx.compose.runtime.Composable
|
|
|
|
import androidx.compose.ui.Modifier
|
2021-12-09 12:21:30 -08:00
|
|
|
import androidx.compose.ui.platform.testTag
|
2021-11-08 09:31:10 -08:00
|
|
|
import androidx.compose.ui.tooling.preview.Preview
|
|
|
|
import androidx.compose.ui.unit.dp
|
2022-02-21 06:50:09 -08:00
|
|
|
import co.electriccoin.zcash.spackle.model.Index
|
2022-03-08 11:05:03 -08:00
|
|
|
import co.electriccoin.zcash.ui.design.theme.ZcashTheme
|
2021-11-08 09:31:10 -08:00
|
|
|
|
|
|
|
@Preview
|
|
|
|
@Composable
|
|
|
|
fun ComposablePreview() {
|
|
|
|
ZcashTheme(darkTheme = false) {
|
2021-11-17 12:19:49 -08:00
|
|
|
Chip(Index(0), "edict")
|
2021-11-08 09:31:10 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
fun Chip(
|
|
|
|
index: Index,
|
|
|
|
text: String,
|
2021-11-17 12:19:49 -08:00
|
|
|
modifier: Modifier = Modifier,
|
2021-11-08 09:31:10 -08:00
|
|
|
) {
|
|
|
|
Surface(
|
2021-11-17 12:19:49 -08:00
|
|
|
modifier = modifier.then(Modifier.padding(4.dp)),
|
2022-02-21 06:33:40 -08:00
|
|
|
shape = RoundedCornerShape(8.dp),
|
|
|
|
color = MaterialTheme.colorScheme.secondary,
|
|
|
|
shadowElevation = 8.dp,
|
2021-11-08 09:31:10 -08:00
|
|
|
) {
|
2021-12-09 12:21:30 -08:00
|
|
|
Row(
|
|
|
|
modifier = Modifier
|
|
|
|
.padding(8.dp)
|
|
|
|
) {
|
2021-11-08 09:31:10 -08:00
|
|
|
Text(
|
2021-11-17 12:19:49 -08:00
|
|
|
text = (index.value + 1).toString(),
|
2021-11-08 09:31:10 -08:00
|
|
|
style = ZcashTheme.typography.chipIndex,
|
|
|
|
color = ZcashTheme.colors.chipIndex,
|
|
|
|
)
|
|
|
|
Spacer(modifier = Modifier.padding(horizontal = 2.dp, vertical = 0.dp))
|
|
|
|
Text(
|
|
|
|
text = text,
|
2022-02-21 06:33:40 -08:00
|
|
|
style = MaterialTheme.typography.bodyLarge,
|
|
|
|
color = MaterialTheme.colorScheme.onSecondary,
|
2021-12-09 12:21:30 -08:00
|
|
|
modifier = Modifier.testTag(CommonTag.CHIP)
|
2021-11-08 09:31:10 -08:00
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|