-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
84 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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
53 changes: 53 additions & 0 deletions
53
...on/src/main/kotlin/app/k9mail/feature/account/common/ui/AccountTopAppBarWithBackButton.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package app.k9mail.feature.account.common.ui | ||
|
||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import app.k9mail.core.ui.compose.common.DevicePreviews | ||
import app.k9mail.core.ui.compose.designsystem.atom.button.ButtonIcon | ||
import app.k9mail.core.ui.compose.designsystem.organism.TopAppBar | ||
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 app.k9mail.feature.account.common.R | ||
|
||
/** | ||
* Top app bar for the account screens with a back button. | ||
* | ||
* @param title The title of the screen. | ||
* @param modifier Modifier for styling. | ||
* @param onBackClicked Callback for when the back button is clicked. | ||
*/ | ||
@Composable | ||
fun AccountTopAppBarWithBackButton( | ||
title: String, | ||
modifier: Modifier = Modifier, | ||
onBackClicked: () -> Unit, | ||
) { | ||
TopAppBar( | ||
title = title, | ||
modifier = modifier, | ||
subtitle = stringResource(id = R.string.account_common_title), | ||
titleContentPadding = PaddingValues( | ||
start = MainTheme.spacings.default, | ||
), | ||
navigationIcon = { | ||
ButtonIcon( | ||
onClick = onBackClicked, | ||
imageVector = Icons.Outlined.arrowBack, | ||
) | ||
}, | ||
) | ||
} | ||
|
||
@DevicePreviews | ||
@Composable | ||
internal fun AccountTopAppBarWithBackButtonPreview() { | ||
PreviewWithThemes { | ||
AccountTopAppBarWithBackButton( | ||
title = "Title", | ||
onBackClicked = {}, | ||
) | ||
} | ||
} |
This file contains 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
This file contains 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