For #21729 - Refactor SectionHeader to use the right font size
This commit is contained in:
parent
5208f74cd7
commit
dd20d98779
|
@ -7,7 +7,6 @@ package org.mozilla.fenix.compose
|
|||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.Font
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
|
@ -28,41 +27,14 @@ fun SectionHeader(
|
|||
modifier: Modifier = Modifier
|
||||
) {
|
||||
Text(
|
||||
modifier = modifier,
|
||||
text = text,
|
||||
style = TextStyle(
|
||||
fontFamily = FontFamily(Font(R.font.metropolis_semibold)),
|
||||
fontSize = 20.sp,
|
||||
lineHeight = 20.sp
|
||||
),
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
color = FirefoxTheme.colors.textPrimary
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Default layout for the header of a screen section.
|
||||
*
|
||||
* @param text [String] to be styled as header and displayed.
|
||||
* @param modifier [Modifier] to be applied to the [Text].
|
||||
*/
|
||||
@Composable
|
||||
fun HomeSectionHeader(
|
||||
text: String,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
Text(
|
||||
modifier = modifier,
|
||||
text = text,
|
||||
style = TextStyle(
|
||||
fontFamily = FontFamily(Font(R.font.metropolis_semibold)),
|
||||
fontSize = 16.sp,
|
||||
lineHeight = 20.sp
|
||||
),
|
||||
maxLines = 1,
|
||||
color = FirefoxTheme.colors.textPrimary,
|
||||
fontSize = 16.sp,
|
||||
fontFamily = FontFamily(Font(R.font.metropolis_semibold)),
|
||||
lineHeight = 20.sp,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
color = FirefoxTheme.colors.textPrimary
|
||||
maxLines = 1
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -71,9 +43,3 @@ fun HomeSectionHeader(
|
|||
private fun HeadingTextPreview() {
|
||||
SectionHeader(text = "Section title")
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Preview
|
||||
private fun HomeHeadingTextPreview() {
|
||||
HomeSectionHeader(text = "Home section title")
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import mozilla.components.lib.state.ext.observeAsComposableState
|
||||
import mozilla.components.service.pocket.PocketRecommendedStory
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.compose.HomeSectionHeader
|
||||
import org.mozilla.fenix.compose.SectionHeader
|
||||
import org.mozilla.fenix.home.HomeFragmentStore
|
||||
import org.mozilla.fenix.theme.FirefoxTheme
|
||||
|
||||
|
@ -93,7 +93,7 @@ fun PocketStories(
|
|||
}
|
||||
|
||||
Column(modifier = Modifier.padding(vertical = 44.dp)) {
|
||||
HomeSectionHeader(
|
||||
SectionHeader(
|
||||
text = stringResource(R.string.pocket_stories_header_1),
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
|
@ -106,7 +106,7 @@ fun PocketStories(
|
|||
|
||||
Spacer(Modifier.height(24.dp))
|
||||
|
||||
HomeSectionHeader(
|
||||
SectionHeader(
|
||||
text = stringResource(R.string.pocket_stories_categories_header),
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
|
|
Loading…
Reference in New Issue
Block a user