Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: selected correct answer color #121

Merged
merged 2 commits into from
Feb 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions plugins/qeta/src/components/QuestionPage/VoteButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import {
import {
Box,
IconButton,
Theme,
Tooltip,
Typography,
useTheme,
createStyles,
makeStyles,
} from '@material-ui/core';
import ArrowDownward from '@material-ui/icons/ArrowDownward';
import ArrowUpward from '@material-ui/icons/ArrowUpward';
Expand All @@ -16,6 +18,17 @@ import React from 'react';
import { useAnalytics, useApi } from '@backstage/core-plugin-api';
import { qetaApiRef } from '../../api';

const useStyles = makeStyles((theme: Theme) =>
createStyles({
qetaCorrectAnswerSelected: {
color: theme.palette.success.main,
},
qetaCorrectAnswer: {
color: theme.palette.grey[500],
},
}),
);

export const VoteButtons = (props: {
entity: QuestionResponse | AnswerResponse;
question?: QuestionResponse;
Expand All @@ -29,9 +42,10 @@ export const VoteButtons = (props: {
props.entity,
);
const qetaApi = useApi(qetaApiRef);
const theme = useTheme();

const isQuestion = 'title' in entity;
const own = props.entity.own ?? false;
const classes = useStyles();

const voteUp = () => {
if (isQuestion) {
Expand Down Expand Up @@ -155,14 +169,9 @@ export const VoteButtons = (props: {
<Check
className={
correct
? 'qetaCorrectAnswerSelected'
: 'qetaCorrectAnswer'
? classes.qetaCorrectAnswerSelected
: classes.qetaCorrectAnswer
}
style={{
color: correct
? `${theme.palette.success.main} !important`
: undefined,
}}
/>
</IconButton>
</span>
Expand Down