Skip to content

Commit

Permalink
Fix dark mode divider color in JetpackDropdownMenu
Browse files Browse the repository at this point in the history
  • Loading branch information
RenanLukas committed Dec 12, 2023
1 parent 97ad720 commit d43ea0e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import me.saket.cascade.CascadeDropdownMenu
Expand Down Expand Up @@ -47,7 +46,9 @@ fun JetpackDropdownMenu(menuItems: List<MenuElementData>, defaultItem: MenuEleme
is MenuElementData.Item -> Item(element, onMenuItemClick)
}
if (element.hasDivider) {
Divider()
Divider(
color = itemDividerColor(),
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package org.wordpress.android.ui.compose.components.menu.dropdown

import androidx.compose.material.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import org.wordpress.android.ui.compose.theme.AppColor

@Composable
fun isLightTheme(): Boolean = androidx.compose.material.MaterialTheme.colors.isLight
fun isLightTheme(): Boolean = MaterialTheme.colors.isLight

@Composable
fun itemContentColor(): Color = if (isLightTheme()) {
Expand All @@ -20,3 +21,10 @@ fun itemBackgroundColor(): Color = if (isLightTheme()) {
} else {
AppColor.DarkGray90
}

@Composable
fun itemDividerColor(): Color = if (isLightTheme()) {
MaterialTheme.colors.onSurface.copy(alpha = 0.12f)
} else {
AppColor.Gray50
}

0 comments on commit d43ea0e

Please sign in to comment.