[question][fix] use absolute path in back button

pull/411/head
Jeff Sieu 3 years ago
parent 3c3b219fda
commit 3d9f5dfedd

@ -1,5 +1,6 @@
import type { ComponentProps } from 'react';
import { useMemo } from 'react';
import { Popover } from '@headlessui/react';
import { Badge } from '@tih/ui';
type BadgeProps = ComponentProps<typeof Badge>;
@ -22,7 +23,7 @@ export default function QuestionAggregateBadge({
return mostCommon;
},
{ key: '', value: 0 },
),
),
[statistics],
);
@ -35,5 +36,16 @@ export default function QuestionAggregateBadge({
return `${mostCommonStatistic.key} (+${additionalStatisticCount})`;
}, [mostCommonStatistic, additionalStatisticCount]);
return <Badge label={label} {...badgeProps} />;
return (
<Popover>
<Popover.Button>
<Badge label={label} {...badgeProps} />
</Popover.Button>
<Popover.Panel>
<div className="flex flex-col gap-2">
<h1>Hello</h1>
</div>
</Popover.Panel>
</Popover>
);
}

@ -51,10 +51,6 @@ export default function QuestionPage() {
},
);
const handleBackNavigation = () => {
router.back();
};
const handleSubmitComment = (data: AnswerCommentData) => {
resetComment();
addComment({
@ -73,10 +69,11 @@ export default function QuestionPage() {
<Button
addonPosition="start"
display="inline"
href={`/questions/${router.query.questionId}/${router.query.questionSlug}`}
icon={ArrowSmallLeftIcon}
label="Back"
variant="secondary"
onClick={handleBackNavigation}></Button>
/>
</div>
<div className="flex w-full justify-center overflow-y-auto py-4 px-5">
<div className="flex max-w-7xl flex-1 flex-col gap-2">

@ -91,10 +91,6 @@ export default function QuestionPage() {
},
);
const handleBackNavigation = () => {
router.back();
};
const handleSubmitAnswer = (data: AnswerQuestionData) => {
addAnswer({
content: data.answerContent,
@ -121,10 +117,11 @@ export default function QuestionPage() {
<Button
addonPosition="start"
display="inline"
href="/questions"
icon={ArrowSmallLeftIcon}
label="Back"
variant="secondary"
onClick={handleBackNavigation}></Button>
/>
</div>
<div className="flex w-full justify-center overflow-y-auto py-4 px-5">
<div className="flex max-w-7xl flex-1 flex-col gap-2">

Loading…
Cancel
Save