1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 package org.mozilla.fenix.compose
7 import androidx.compose.foundation.background
8 import androidx.compose.foundation.layout.Box
9 import androidx.compose.foundation.layout.Column
10 import androidx.compose.foundation.layout.Row
11 import androidx.compose.foundation.layout.fillMaxHeight
12 import androidx.compose.foundation.layout.height
13 import androidx.compose.foundation.layout.padding
14 import androidx.compose.foundation.layout.width
15 import androidx.compose.material.Text
16 import androidx.compose.runtime.Composable
17 import androidx.compose.ui.Modifier
18 import androidx.compose.ui.graphics.Color
19 import androidx.compose.ui.unit.dp
20 import org.mozilla.fenix.compose.annotation.LightDarkPreview
21 import org.mozilla.fenix.theme.FirefoxTheme
26 * @param modifier [Modifier] used to be applied to the layout of the divider.
27 * @param color [Color] of the divider line.
31 modifier: Modifier = Modifier,
32 color: Color = FirefoxTheme.colors.borderPrimary,
34 androidx.compose.material.Divider(
41 * An example of a vertical divider.
45 private fun VerticalDividerPreview() {
49 .background(FirefoxTheme.colors.layer1)
54 text = "Before the line",
55 modifier = Modifier.padding(end = 10.dp),
62 .padding(vertical = 10.dp),
66 text = "After the line",
67 modifier = Modifier.padding(start = 10.dp),
75 * An example of divider usage in a list menu.
79 private fun HorizontalDividerPreview() {
83 .background(FirefoxTheme.colors.layer1)
87 Column(Modifier.padding(start = 4.dp)) {
92 Text(text = "Open Recent")
94 Divider(modifier = Modifier.padding(vertical = 10.dp, horizontal = 24.dp))
100 Text(text = "Save as")
102 Text(text = "Rename")
104 Divider(modifier = Modifier.padding(vertical = 10.dp, horizontal = 24.dp))