Add TopAppBar template

This commit is contained in:
Wolf Montwé 2023-03-28 11:22:36 +02:00 committed by Wolf-Martell Montwé
parent b065a7153c
commit b983f1fad8
No known key found for this signature in database
GPG key ID: 6D45B21512ACBF72

View file

@ -0,0 +1,55 @@
package app.k9mail.core.ui.compose.designsystem.organism
import androidx.compose.foundation.layout.RowScope
import androidx.compose.material.Icon
import androidx.compose.material.IconButton
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.core.ui.compose.theme.Icons
import app.k9mail.core.ui.compose.theme.MainTheme
import app.k9mail.core.ui.compose.theme.PreviewWithThemes
import androidx.compose.material.TopAppBar as MaterialTopAppBar
@Composable
fun TopAppBar(
title: String,
modifier: Modifier = Modifier,
navigationIcon: @Composable (() -> Unit)? = null,
actions: @Composable RowScope.() -> Unit = {},
) {
MaterialTopAppBar(
title = { Text(text = title) },
modifier = modifier,
navigationIcon = navigationIcon,
actions = actions,
backgroundColor = MainTheme.colors.toolbar,
)
}
@Preview
@Composable
internal fun TopAppBarPreview() {
PreviewWithThemes {
TopAppBar(
title = "Title",
navigationIcon = {
IconButton(onClick = {}) {
Icon(
imageVector = Icons.Outlined.menu,
contentDescription = null,
)
}
},
actions = {
IconButton(onClick = {}) {
Icon(
imageVector = Icons.Outlined.menu,
contentDescription = null,
)
}
},
)
}
}