From 558c0964e40e47748e7b12eb19ea918f4e0d3737 Mon Sep 17 00:00:00 2001 From: Vyacheslav Matyukhin Date: Tue, 31 May 2022 23:59:51 +0300 Subject: [PATCH] feat: section anchors --- src/web/questions/pages/QuestionPage.tsx | 33 ++++++++++++++++++------ 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/src/web/questions/pages/QuestionPage.tsx b/src/web/questions/pages/QuestionPage.tsx index f1d6e85..d19af1e 100644 --- a/src/web/questions/pages/QuestionPage.tsx +++ b/src/web/questions/pages/QuestionPage.tsx @@ -42,10 +42,27 @@ export const getServerSideProps: GetServerSideProps = async ( }; }; -const Section: React.FC<{ title: string }> = ({ title, children }) => ( -
-
-

{title}

+const Section: React.FC<{ title: string; id?: string }> = ({ + title, + children, + id, +}) => ( +
+
+

+ {title} + {id ? ( + <> + {" "} + + # + + + ) : null} +

{children}
@@ -56,7 +73,7 @@ const EmbedSection: React.FC<{ question: QuestionWithHistoryFragment }> = ({ }) => { const url = getBasePath() + `/questions/embed/${question.id}`; return ( -
+
Preview @@ -86,7 +103,7 @@ const LargeQuestionCard: React.FC<{
-
+
-
+
-
+