From 2fa41f583eae6b9dcd3f4afc086eeb185da99a6c Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Fri, 22 Sep 2023 05:15:52 +0100 Subject: [PATCH] Add react questions --- src/components/CommandMenu/CommandMenu.tsx | 8 ++++++++ src/components/Navigation/Navigation.astro | 4 ++-- src/icons/clipboard.svg | 9 +++++++++ src/pages/index.astro | 18 +++++++++--------- src/pages/pages.json.ts | 8 ++++++++ 5 files changed, 36 insertions(+), 11 deletions(-) create mode 100644 src/icons/clipboard.svg diff --git a/src/components/CommandMenu/CommandMenu.tsx b/src/components/CommandMenu/CommandMenu.tsx index cdc646b4c..7e5cc368e 100644 --- a/src/components/CommandMenu/CommandMenu.tsx +++ b/src/components/CommandMenu/CommandMenu.tsx @@ -2,6 +2,7 @@ import { Fragment, useEffect, useRef, useState } from 'react'; import { useKeydown } from '../../hooks/use-keydown'; import { useOutsideClick } from '../../hooks/use-outside-click'; import BestPracticesIcon from '../../icons/best-practices.svg'; +import ClipboardIcon from '../../icons/clipboard.svg'; import GuideIcon from '../../icons/guide.svg'; import HomeIcon from '../../icons/home.svg'; import RoadmapIcon from '../../icons/roadmap.svg'; @@ -53,6 +54,13 @@ const defaultPages: PageType[] = [ group: 'Pages', icon: BestPracticesIcon.src, }, + { + id: 'questions', + url: '/questions', + title: 'Questions', + group: 'Pages', + icon: ClipboardIcon.src, + }, { id: 'guides', url: '/guides', diff --git a/src/components/Navigation/Navigation.astro b/src/components/Navigation/Navigation.astro index a87b1d361..9dfb58f45 100644 --- a/src/components/Navigation/Navigation.astro +++ b/src/components/Navigation/Navigation.astro @@ -24,10 +24,10 @@ import AccountDropdown from './AccountDropdown.astro'; >
  • + + + + + + + \ No newline at end of file diff --git a/src/pages/index.astro b/src/pages/index.astro index 60de264c9..9d413c7ed 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -60,15 +60,15 @@ const videos = await getAllVideos(); }))} /> - - - - - - - - - + ({ + text: questionGroup.frontmatter.briefTitle, + url: `/questions/${questionGroup.id}`, + isNew: questionGroup.frontmatter.isNew, + }))} + />
    diff --git a/src/pages/pages.json.ts b/src/pages/pages.json.ts index 67331a227..d123e87cd 100644 --- a/src/pages/pages.json.ts +++ b/src/pages/pages.json.ts @@ -2,10 +2,12 @@ import { getAllBestPractices } from '../lib/best-pratice'; import { getAllGuides } from '../lib/guide'; import { getRoadmapsByTag } from '../lib/roadmap'; import { getAllVideos } from '../lib/video'; +import {getAllQuestionGroups} from "../lib/question-group"; export async function GET() { const guides = await getAllGuides(); const videos = await getAllVideos(); + const questionGroups = await getAllQuestionGroups(); const roadmaps = await getRoadmapsByTag('roadmap'); const bestPractices = await getAllBestPractices(); @@ -26,6 +28,12 @@ export async function GET() { title: bestPractice.frontmatter.briefTitle, group: 'Best Practices', })), + ...questionGroups.map((questionGroup) => ({ + id: questionGroup.id, + url: `/questions/${questionGroup.id}`, + title: questionGroup.frontmatter.briefTitle, + group: 'Questions', + })), ...guides.map((guide) => ({ id: guide.id, url: `/guides/${guide.id}`,