Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
For #22637 - Add new color tokens provided by the mobile styles to Fi…
Browse files Browse the repository at this point in the history
…refoxTheme
  • Loading branch information
gabrielluong authored and mergify[bot] committed Dec 3, 2021
1 parent caea828 commit e20ef25
Show file tree
Hide file tree
Showing 12 changed files with 350 additions and 31 deletions.
Expand Up @@ -110,7 +110,7 @@ private fun ListItemTabSurface(
Card(
modifier = modifier,
shape = RoundedCornerShape(8.dp),
backgroundColor = FirefoxTheme.colors.surface,
backgroundColor = FirefoxTheme.colors.layer2,
elevation = 6.dp
) {
Row(
Expand Down
Expand Up @@ -49,7 +49,7 @@ fun ListItemTabLargePlaceholder(
.size(328.dp, 116.dp)
.clickable { onClick() },
shape = RoundedCornerShape(8.dp),
backgroundColor = FirefoxTheme.colors.surface,
backgroundColor = FirefoxTheme.colors.layer2,
elevation = 6.dp,
) {
Column(
Expand Down
Expand Up @@ -87,7 +87,7 @@ private fun SelectableChipLightThemePreview() {
Row(
modifier = Modifier
.fillMaxWidth()
.background(FirefoxTheme.colors.surface),
.background(FirefoxTheme.colors.layer2),
horizontalArrangement = Arrangement.SpaceEvenly
) {
SelectableChip("Chirp", false) { }
Expand Down
Expand Up @@ -121,7 +121,7 @@ fun StaggeredHorizontalGrid(
@Preview
private fun StaggeredHorizontalGridPreview() {
FirefoxTheme {
Box(Modifier.background(FirefoxTheme.colors.surface)) {
Box(Modifier.background(FirefoxTheme.colors.layer2)) {
StaggeredHorizontalGrid(
horizontalItemsSpacing = 8.dp,
arrangement = Arrangement.Center
Expand Down
8 changes: 6 additions & 2 deletions app/src/main/java/org/mozilla/fenix/compose/TabSubtitle.kt
Expand Up @@ -5,6 +5,7 @@
package org.mozilla.fenix.compose

import androidx.compose.foundation.background
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Box
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -32,15 +33,18 @@ fun TabSubtitle(
text = text,
style = TextStyle(fontSize = 12.sp),
overflow = TextOverflow.Ellipsis,
color = FirefoxTheme.colors.textSecondary
color = when (isSystemInDarkTheme()) {
true -> FirefoxTheme.colors.textPrimary
false -> FirefoxTheme.colors.textSecondary
}
)
}

@Composable
@Preview
private fun TabSubtitlePreview() {
FirefoxTheme {
Box(Modifier.background(FirefoxTheme.colors.surface)) {
Box(Modifier.background(FirefoxTheme.colors.layer2)) {
TabSubtitle(
"Awesome tab subtitle",
)
Expand Down
Expand Up @@ -85,7 +85,7 @@ fun TabSubtitleWithInterdot(
@Preview
private fun TabSubtitleWithInterdotPreview() {
FirefoxTheme {
Box(Modifier.background(FirefoxTheme.colors.surface)) {
Box(Modifier.background(FirefoxTheme.colors.layer2)) {
TabSubtitleWithInterdot(
firstText = "firstText",
secondText = "secondText",
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/org/mozilla/fenix/compose/TabTitle.kt
Expand Up @@ -43,7 +43,7 @@ fun TabTitle(
@Preview
private fun TabTitlePreview() {
FirefoxTheme {
Box(Modifier.background(FirefoxTheme.colors.surface)) {
Box(Modifier.background(FirefoxTheme.colors.layer2)) {
TabTitle(
"Awesome tab title",
2
Expand Down
Expand Up @@ -243,7 +243,7 @@ fun PoweredByPocketHeader(
@Preview
private fun PocketStoriesComposablesPreview() {
FirefoxTheme {
Box(Modifier.background(FirefoxTheme.colors.surface)) {
Box(Modifier.background(FirefoxTheme.colors.layer2)) {
Column {
PocketStories(
stories = getFakePocketStories(8),
Expand Down
Expand Up @@ -114,7 +114,7 @@ private fun RecentTabItem(
.height(112.dp)
.clickable { onRecentTabClick(tab.state.id) },
shape = RoundedCornerShape(8.dp),
backgroundColor = FirefoxTheme.colors.surface,
backgroundColor = FirefoxTheme.colors.layer2,
elevation = 6.dp
) {
Row(
Expand Down Expand Up @@ -175,7 +175,7 @@ private fun RecentSearchGroupItem(
.height(112.dp)
.clickable { onSearchGroupClicked(tabId) },
shape = RoundedCornerShape(8.dp),
backgroundColor = FirefoxTheme.colors.surface,
backgroundColor = FirefoxTheme.colors.layer2,
elevation = 6.dp
) {
Row(
Expand All @@ -202,7 +202,10 @@ private fun RecentSearchGroupItem(
painter = painterResource(id = R.drawable.ic_all_tabs),
modifier = Modifier.size(18.dp),
contentDescription = null,
tint = FirefoxTheme.colors.textSecondary
tint = when (isSystemInDarkTheme()) {
true -> FirefoxTheme.colors.textPrimary
false -> FirefoxTheme.colors.textSecondary
}
)

Spacer(modifier = Modifier.width(8.dp))
Expand Down Expand Up @@ -376,7 +379,10 @@ private fun RecentTabTitle(title: String) {
private fun RecentTabSubtitle(subtitle: String) {
Text(
text = subtitle.getRepresentativeSnippet(),
color = FirefoxTheme.colors.textSecondary,
color = when (isSystemInDarkTheme()) {
true -> FirefoxTheme.colors.textPrimary
false -> FirefoxTheme.colors.textSecondary
},
fontSize = 12.sp,
overflow = TextOverflow.Ellipsis,
maxLines = 1
Expand Down
Expand Up @@ -11,6 +11,7 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.gestures.Orientation
import androidx.compose.foundation.gestures.scrollable
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
Expand Down Expand Up @@ -73,7 +74,7 @@ fun RecentlyVisited(
Card(
modifier = Modifier.fillMaxWidth(),
shape = RoundedCornerShape(8.dp),
backgroundColor = FirefoxTheme.colors.surface,
backgroundColor = FirefoxTheme.colors.layer2,
elevation = 6.dp
) {
LazyRow(
Expand Down Expand Up @@ -258,7 +259,10 @@ private fun RecentlyVisitedCaption(count: Int) {

Text(
text = String.format(LocalContext.current.getString(stringId), count),
color = FirefoxTheme.colors.textSecondary,
color = when (isSystemInDarkTheme()) {
true -> FirefoxTheme.colors.textPrimary
false -> FirefoxTheme.colors.textSecondary
},
fontSize = 12.sp,
overflow = TextOverflow.Ellipsis,
maxLines = 1
Expand Down Expand Up @@ -286,7 +290,7 @@ private fun RecentlyVisitedMenu(
expanded = showMenu,
onDismissRequest = { onDismissRequest() },
modifier = Modifier
.background(color = FirefoxTheme.colors.surface)
.background(color = FirefoxTheme.colors.layer2)
.height(52.dp)
.scrollable(
state = ScrollState(0),
Expand Down Expand Up @@ -332,7 +336,7 @@ private fun RecentlyVisitedDivider(
) {
Divider(
modifier = modifier,
color = FirefoxTheme.colors.dividerLine,
color = FirefoxTheme.colors.borderDivider,
thickness = 0.5.dp
)
}
Expand Down

0 comments on commit e20ef25

Please sign in to comment.