mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 21:07:04 +05:30
refactor(android): rework sorting mechanism and saved posts month header
This commit is contained in:
parent
a23037ce70
commit
c5a3562608
3 changed files with 27 additions and 20 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright © 2022 Harsh Shandilya.
|
||||
* Copyright © 2022-2024 Harsh Shandilya.
|
||||
* Use of this source code is governed by an MIT-style
|
||||
* license that can be found in the LICENSE file or at
|
||||
* https://opensource.org/licenses/MIT.
|
||||
|
@ -15,18 +15,15 @@ import androidx.compose.material3.MaterialTheme
|
|||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.text.capitalize
|
||||
import androidx.compose.ui.text.intl.Locale
|
||||
import androidx.compose.ui.unit.dp
|
||||
import dev.msfjarvis.claw.common.theme.LobstersTheme
|
||||
import dev.msfjarvis.claw.common.ui.preview.DevicePreviews
|
||||
import dev.msfjarvis.claw.common.ui.preview.ThemePreviews
|
||||
import dev.msfjarvis.claw.common.ui.surfaceColorAtNavigationBarElevation
|
||||
import java.time.Month
|
||||
|
||||
@Composable
|
||||
fun MonthHeader(
|
||||
month: Month,
|
||||
label: String,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Box(
|
||||
|
@ -36,7 +33,7 @@ fun MonthHeader(
|
|||
.background(MaterialTheme.colorScheme.surfaceColorAtNavigationBarElevation())
|
||||
) {
|
||||
Text(
|
||||
text = month.name.lowercase().capitalize(Locale.current),
|
||||
text = label,
|
||||
style = MaterialTheme.typography.headlineSmall,
|
||||
modifier = Modifier.padding(horizontal = 12.dp, vertical = 12.dp),
|
||||
)
|
||||
|
@ -47,5 +44,5 @@ fun MonthHeader(
|
|||
@ThemePreviews
|
||||
@Composable
|
||||
fun MonthHeaderPreview() {
|
||||
LobstersTheme { MonthHeader(month = Month.APRIL) }
|
||||
LobstersTheme { MonthHeader("April 2023") }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue