Skip to content

Commit

Permalink
feat: Add 2nd constructor for SwissTransferTopAppBar()
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinBoulongne committed Nov 6, 2024
1 parent ce279d1 commit 7323ecb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ import com.infomaniak.swisstransfer.ui.images.icons.Cross
import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme
import com.infomaniak.swisstransfer.ui.utils.PreviewAllWindows

@Composable
fun SwissTransferTopAppBar(
@StringRes titleRes: Int,
navigationMenu: TopAppBarButton? = null,
vararg actionMenus: TopAppBarButton,
) {
SwissTransferTopAppBar(title = stringResource(titleRes), navigationMenu, *actionMenus)
}

@Composable
@OptIn(ExperimentalMaterial3Api::class)
fun SwissTransferTopAppBar(
Expand Down Expand Up @@ -79,7 +88,7 @@ data class TopAppBarButton(
private fun SwissTransferTopAppBarPreview() {
SwissTransferTheme {
SwissTransferTopAppBar(
title = stringResource(R.string.appName),
titleRes = R.string.appName,
navigationMenu = TopAppBarButton.backButton {},
TopAppBarButton(AppIcons.Add, R.string.appName) {},
TopAppBarButton.closeButton {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import com.infomaniak.swisstransfer.R
import com.infomaniak.swisstransfer.ui.components.SwissTransferTopAppBar
import com.infomaniak.swisstransfer.ui.components.TopAppBarButton
Expand All @@ -48,7 +47,7 @@ fun OptionScaffold(
SmallWindowTopAppBarScaffold(
smallWindowTopAppBar = {
SwissTransferTopAppBar(
title = stringResource(topAppBarTitleRes),
titleRes = topAppBarTitleRes,
navigationMenu = TopAppBarButton.backButton(navigateBack ?: {}),
)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ private fun ImportFilesScreen(
BottomStickyButtonScaffold(
topBar = {
SwissTransferTopAppBar(
title = stringResource(R.string.importFilesScreenTitle),
titleRes = R.string.importFilesScreenTitle,
navigationMenu = null,
TopAppBarButton.closeButton { closeActivity() },
)
Expand Down

0 comments on commit 7323ecb

Please sign in to comment.