parent
26032d16f6
commit
21bc9bdf4d
@ -0,0 +1,26 @@
|
||||
import { ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/24/outline';
|
||||
import { Button } from '@tih/ui';
|
||||
|
||||
export type VotingButtonsProps = {
|
||||
upvoteCount: number;
|
||||
};
|
||||
|
||||
export default function VotingButtons({ upvoteCount }: VotingButtonsProps) {
|
||||
return (
|
||||
<div className="flex flex-col items-center">
|
||||
<Button
|
||||
icon={ChevronUpIcon}
|
||||
isLabelHidden={true}
|
||||
label="Upvote"
|
||||
variant="tertiary"
|
||||
/>
|
||||
<p>{upvoteCount}</p>
|
||||
<Button
|
||||
icon={ChevronDownIcon}
|
||||
isLabelHidden={true}
|
||||
label="Downvote"
|
||||
variant="tertiary"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
import VotingButtons from '../VotingButtons';
|
||||
|
||||
export type AnswerCardProps = {
|
||||
author: string;
|
||||
content: string;
|
||||
upvoteCount: number;
|
||||
};
|
||||
|
||||
export default function AnswerCard({
|
||||
author,
|
||||
upvoteCount,
|
||||
content,
|
||||
}: AnswerCardProps) {
|
||||
return (
|
||||
<div className="flex gap-4 rounded-md border p-4">
|
||||
<VotingButtons upvoteCount={upvoteCount} />
|
||||
<div>
|
||||
<h1 className="font-bold">{author}</h1>
|
||||
<p>{content}</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
import { Button, Collapsible, TextArea } from '@tih/ui';
|
||||
|
||||
import AnswerCard from '~/components/questions/card/AnswerCard';
|
||||
import QuestionOverviewCard from '~/components/questions/card/QuestionOverviewCard';
|
||||
|
||||
import { SAMPLE_QUESTION } from '~/utils/questions/constants';
|
||||
|
||||
export default function QuestionPage() {
|
||||
const question = SAMPLE_QUESTION;
|
||||
return (
|
||||
<div className="flex w-full flex-col items-center overflow-y-auto p-4">
|
||||
<div className="flex max-w-7xl flex-col gap-2">
|
||||
<h1 className="text-2xl">Question overview</h1>
|
||||
<QuestionOverviewCard {...question} />
|
||||
<Collapsible label="256 comments">
|
||||
<div>Comment placeholder</div>
|
||||
</Collapsible>
|
||||
<TextArea label="Contribute an answer" rows={5} />
|
||||
<div className="flex justify-end">
|
||||
<Button label="Contribute" variant="primary" />
|
||||
</div>
|
||||
<p>{question.answerCount} answers</p>
|
||||
{Array.from({ length: question.answerCount }).map((_, index) => (
|
||||
<AnswerCard
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
key={index}
|
||||
author="James Smith"
|
||||
content="Hello"
|
||||
upvoteCount={10}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
Loading…
Reference in new issue