Skip to content

Commit

Permalink
Fix vote theme for inbox (#1446)
Browse files Browse the repository at this point in the history
Resolves #1445
  • Loading branch information
aeharding committed Apr 30, 2024
1 parent 67f2896 commit 51b666e
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/features/inbox/VoteArrow.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { IonIcon } from "@ionic/react";
import { styled } from "@linaria/react";
import { arrowDown, arrowUp } from "ionicons/icons";
import {
VOTE_COLORS,
bgColorToVariable,
} from "../settings/appearance/themes/votesTheme/VotesTheme";
import { useAppSelector } from "../../store";

const Container = styled.div`
font-size: 1.4em;
Expand All @@ -23,18 +28,28 @@ interface VoteArrowProps {
}

export default function VoteArrow({ vote }: VoteArrowProps) {
const votesTheme = useAppSelector(
(state) => state.settings.appearance.votesTheme,
);

if (!vote) return null;

if (vote === 1)
return (
<Container>
<VoteIcon icon={arrowUp} color="primary" />
<VoteIcon
icon={arrowUp}
style={{ color: bgColorToVariable(VOTE_COLORS.UPVOTE[votesTheme]) }}
/>
</Container>
);
if (vote === -1)
return (
<Container>
<VoteIcon icon={arrowDown} color="danger" />
<VoteIcon
icon={arrowDown}
style={{ color: bgColorToVariable(VOTE_COLORS.DOWNVOTE[votesTheme]) }}
/>
</Container>
);
}

0 comments on commit 51b666e

Please sign in to comment.