Add TopAppBar template
This commit is contained in:
parent
b065a7153c
commit
b983f1fad8
1 changed files with 55 additions and 0 deletions
|
@ -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,
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue