For #24467 - Enable Contile setting telemetry

upstream-sync
Noah Bond 2 years ago committed by mergify[bot]
parent d9169af323
commit 57238fa5ca

@ -36,7 +36,9 @@ import org.mozilla.fenix.theme.FirefoxTheme
* @param expandActionContentDescription The content description for expanding the section.
* @param collapseActionContentDescription The content description for collapsing the section.
* @param onClick Optional lambda for handling header clicks.
* @param actions Optional Composable for adding UI to the end of the header.
*/
@Suppress("LongParameterList")
@Composable
fun ExpandableListHeader(
headerText: String,
@ -44,10 +46,14 @@ fun ExpandableListHeader(
expandActionContentDescription: String? = null,
collapseActionContentDescription: String? = null,
onClick: () -> Unit = {},
actions: @Composable () -> Unit = {},
) {
Row(
modifier = Modifier.fillMaxWidth(),
) {
Row(
modifier = Modifier
.fillMaxWidth()
.weight(1f)
.clickable(onClick = onClick)
.padding(horizontal = 16.dp, vertical = 8.dp),
verticalAlignment = Alignment.CenterVertically,
@ -76,6 +82,9 @@ fun ExpandableListHeader(
)
}
}
actions()
}
}
@Composable
@ -103,3 +112,52 @@ private fun CollapsibleHeaderPreview() {
}
}
}
@Composable
@Preview(uiMode = Configuration.UI_MODE_NIGHT_NO)
private fun HeaderWithClickableIconPreview() {
FirefoxTheme {
Box(Modifier.background(FirefoxTheme.colors.layer1)) {
ExpandableListHeader(headerText = "Section title") {
Box(
modifier = Modifier
.clickable(onClick = { println("delete clicked") })
.padding(horizontal = 16.dp, vertical = 8.dp),
) {
Icon(
painter = painterResource(R.drawable.ic_delete),
contentDescription = "click me",
modifier = Modifier.size(20.dp),
tint = FirefoxTheme.colors.iconPrimary,
)
}
}
}
}
}
@Composable
@Preview(uiMode = Configuration.UI_MODE_NIGHT_NO)
private fun CollapsibleHeaderWithClickableIconPreview() {
FirefoxTheme {
Box(Modifier.background(FirefoxTheme.colors.layer1)) {
ExpandableListHeader(
headerText = "Section title",
expanded = true,
) {
Box(
modifier = Modifier
.clickable(onClick = { println("delete clicked") })
.padding(horizontal = 16.dp, vertical = 8.dp),
) {
Icon(
painter = painterResource(R.drawable.ic_delete),
contentDescription = "click me",
modifier = Modifier.size(20.dp),
tint = FirefoxTheme.colors.iconPrimary,
)
}
}
}
}
}

Loading…
Cancel
Save