For #22832 - Added parameters to base Text composables

upstream-sync
Noah Bond 3 years ago committed by mergify[bot]
parent 0ac2899570
commit 8ca1a7e271

@ -7,6 +7,8 @@ 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.font.FontFamily
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.TextUnit
import org.mozilla.fenix.theme.FirefoxTheme
@ -16,13 +18,20 @@ import org.mozilla.fenix.theme.FirefoxTheme
* @param text The text to be displayed.
* @param modifier [Modifier] to apply to this layout node.
* @param fontSize The size of glyphs to use when painting the text.
* @param fontFamily The font family to be used when rendering the text.
* @param letterSpacing The amount of space to add between each letter.
* @param overflow How visual overflow should be handled.
* @param maxLines An optional maximum number of lines for the text to span.
*/
@Suppress("LongParameterList")
@Composable
fun PrimaryText(
text: String,
modifier: Modifier = Modifier,
fontSize: TextUnit,
fontFamily: FontFamily? = null,
letterSpacing: TextUnit = TextUnit.Unspecified,
overflow: TextOverflow = TextOverflow.Clip,
maxLines: Int = Int.MAX_VALUE
) {
Text(
@ -30,7 +39,10 @@ fun PrimaryText(
modifier = modifier,
color = FirefoxTheme.colors.textPrimary,
fontSize = fontSize,
maxLines = maxLines
fontFamily = fontFamily,
letterSpacing = letterSpacing,
overflow = overflow,
maxLines = maxLines,
)
}
@ -40,13 +52,20 @@ fun PrimaryText(
* @param text The text to be displayed.
* @param modifier [Modifier] to apply to this layout node.
* @param fontSize The size of glyphs to use when painting the text.
* @param fontFamily The font family to be used when rendering the text.
* @param letterSpacing The amount of space to add between each letter.
* @param overflow How visual overflow should be handled.
* @param maxLines An optional maximum number of lines for the text to span.
*/
@Suppress("LongParameterList")
@Composable
fun SecondaryText(
text: String,
modifier: Modifier = Modifier,
fontSize: TextUnit,
fontFamily: FontFamily? = null,
letterSpacing: TextUnit = TextUnit.Unspecified,
overflow: TextOverflow = TextOverflow.Clip,
maxLines: Int = Int.MAX_VALUE,
) {
Text(
@ -54,6 +73,9 @@ fun SecondaryText(
modifier = modifier,
color = FirefoxTheme.colors.textSecondary,
fontSize = fontSize,
fontFamily = fontFamily,
letterSpacing = letterSpacing,
overflow = overflow,
maxLines = maxLines
)
}

Loading…
Cancel
Save