Skip to content

Commit

Permalink
Consistent theming for stars
Browse files Browse the repository at this point in the history
  • Loading branch information
wingio committed Sep 17, 2024
1 parent 735178c commit d4fd6ce
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ fun TrendingRepoItem(
if (shouldStar) onStarClick() else onUnstarClick()
},
colors = IconButtonDefaults.filledTonalIconToggleButtonColors(
checkedContentColor = MaterialTheme.gloomColorScheme.statusYellow,
checkedContainerColor = MaterialTheme.gloomColorScheme.statusYellow.copy(alpha = 0.2f)
checkedContentColor = MaterialTheme.gloomColorScheme.star,
checkedContainerColor = MaterialTheme.gloomColorScheme.star.copy(alpha = 0.2f)
),
enabled = starToggleEnabled
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import com.materiiapps.gloom.api.dto.user.User
import com.materiiapps.gloom.gql.fragment.FeedRepository
import com.materiiapps.gloom.ui.component.Avatar
import com.materiiapps.gloom.ui.screen.repo.RepoScreen
import com.materiiapps.gloom.ui.theme.gloomColorScheme
import com.materiiapps.gloom.ui.util.NumberFormatter
import com.materiiapps.gloom.ui.util.navigate
import com.materiiapps.gloom.ui.util.parsedColor
Expand All @@ -59,7 +60,11 @@ fun FeedRepoCard(
val nav = LocalNavigator.currentOrThrow
val viewerHasStarred = starData?.first ?: repo.viewerHasStarred
val starCount = starData?.second ?: repo.stargazerCount
val (starColor, starIcon) = if (viewerHasStarred) Color(0xFFF1E05A) to Icons.Filled.Star else LocalContentColor.current to Icons.Outlined.StarBorder
val (starColor, starIcon) = if (viewerHasStarred) {
MaterialTheme.gloomColorScheme.star to Icons.Filled.Star
} else {
LocalContentColor.current to Icons.Outlined.StarBorder
}

ElevatedCard(
onClick = { nav.navigate(RepoScreen(repo.owner.login, repo.name)) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class GloomColorScheme(
statusRed: Color,
statusGrey: Color,
statusYellow: Color,
star: Color,
warning: Color,
onWarning: Color,
warningContainer: Color,
Expand All @@ -42,6 +43,9 @@ class GloomColorScheme(
var statusYellow by mutableStateOf(statusYellow, structuralEqualityPolicy())
internal set

var star by mutableStateOf(star, structuralEqualityPolicy())
internal set

var warning by mutableStateOf(warning, structuralEqualityPolicy())
internal set

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ fun darkGloomColorScheme() = GloomColorScheme(
statusRed = PinkRed,
statusGrey = Grey,
statusYellow = Yellow,
star = Yellow,
warning = YellowAlt1,
onWarning = DarkBrown,
warningContainer = DarkBronze,
Expand All @@ -20,6 +21,7 @@ fun lightGloomColorScheme() = GloomColorScheme(
statusRed = Red,
statusGrey = LightGrey,
statusYellow = Gold,
star = Gold,
warning = BronzeYellow,
onWarning = Color.White,
warningContainer = Shandy,
Expand Down

0 comments on commit d4fd6ce

Please sign in to comment.