Skip to content

Commit

Permalink
Merge pull request #556 from r-kuno-zer0/feature/fix-sponsor-and-cont…
Browse files Browse the repository at this point in the history
…oributor-screen

Fix the Contributor and Sponsor screens to use AnimatedLargeTopAppBar.
  • Loading branch information
takahirom authored Aug 17, 2024
2 parents 441a53c + 4f91e5f commit a639613
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import androidx.compose.ui.unit.dp
fun AnimatedLargeTopAppBar(
title: String,
onBackClick: () -> Unit,
navIconContentDescription: String?,
modifier: Modifier = Modifier,
actions: @Composable RowScope.() -> Unit = {},
windowInsets: WindowInsets = TopAppBarDefaults.windowInsets,
Expand Down Expand Up @@ -92,7 +93,7 @@ fun AnimatedLargeTopAppBar(
) {
Icon(
imageVector = Filled.ArrowBack,
contentDescription = "Back",
contentDescription = navIconContentDescription,
)
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,10 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material.icons.Icons.AutoMirrored.Filled
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.LargeTopAppBar
import androidx.compose.material3.Scaffold
import androidx.compose.material3.SnackbarHost
import androidx.compose.material3.SnackbarHostState
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
Expand All @@ -30,6 +24,7 @@ import io.github.droidkaigi.confsched.contributors.component.ContributorsItem
import io.github.droidkaigi.confsched.model.Contributor
import io.github.droidkaigi.confsched.ui.SnackbarMessageEffect
import io.github.droidkaigi.confsched.ui.UserMessageStateHolder
import io.github.droidkaigi.confsched.ui.component.AnimatedLargeTopAppBar
import io.github.droidkaigi.confsched.ui.handleOnClickIfNotNavigating
import kotlinx.collections.immutable.PersistentList

Expand Down Expand Up @@ -109,22 +104,12 @@ fun ContributorsScreen(
modifier = modifier.testTag(ContributorsScreenTestTag),
snackbarHost = { SnackbarHost(hostState = snackbarHostState) },
topBar = {
if (scrollBehavior != null) {
LargeTopAppBar(
title = {
Text(text = "Contributor")
},
navigationIcon = {
IconButton(
onClick = onBackClick,
) {
Icon(
imageVector = Filled.ArrowBack,
contentDescription = "Back",
)
}
},
if (!isTopAppBarHidden) {
AnimatedLargeTopAppBar(
title = "Contributor",
onBackClick = onBackClick,
scrollBehavior = scrollBehavior,
navIconContentDescription = "Back",
)
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,11 @@ package io.github.droidkaigi.confsched.sponsors
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons.AutoMirrored.Filled
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.LargeTopAppBar
import androidx.compose.material3.Scaffold
import androidx.compose.material3.SnackbarHost
import androidx.compose.material3.SnackbarHostState
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
Expand All @@ -35,6 +29,7 @@ import io.github.droidkaigi.confsched.sponsors.section.SponsorsList
import io.github.droidkaigi.confsched.ui.SnackbarMessageEffect
import io.github.droidkaigi.confsched.ui.UserMessageStateHolder
import io.github.droidkaigi.confsched.ui.UserMessageStateHolderImpl
import io.github.droidkaigi.confsched.ui.component.AnimatedLargeTopAppBar
import io.github.droidkaigi.confsched.ui.handleOnClickIfNotNavigating
import kotlinx.collections.immutable.PersistentList
import kotlinx.collections.immutable.toPersistentList
Expand Down Expand Up @@ -120,22 +115,12 @@ fun SponsorsScreen(
modifier = modifier.testTag(SponsorsScreenTestTag),
snackbarHost = { SnackbarHost(hostState = snackbarHostState) },
topBar = {
if (scrollBehavior != null) {
LargeTopAppBar(
title = {
Text(text = stringResource(SponsorsRes.string.sponsor))
},
navigationIcon = {
IconButton(
onClick = onBackClick,
) {
Icon(
imageVector = Filled.ArrowBack,
contentDescription = stringResource(SponsorsRes.string.content_description_back),
)
}
},
if (!isTopAppBarHidden) {
AnimatedLargeTopAppBar(
title = stringResource(SponsorsRes.string.sponsor),
onBackClick = onBackClick,
scrollBehavior = scrollBehavior,
navIconContentDescription = stringResource(SponsorsRes.string.content_description_back),
)
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ fun StaffScreen(
title = "Staff",
onBackClick = onBackClick,
scrollBehavior = scrollBehavior,
navIconContentDescription = "Back",
)
}
},
Expand Down

0 comments on commit a639613

Please sign in to comment.