diff --git a/src/components/Breadcrumbs.astro b/src/components/Breadcrumbs.astro new file mode 100644 index 000000000..74594cdef --- /dev/null +++ b/src/components/Breadcrumbs.astro @@ -0,0 +1,39 @@ +--- +import type { BreadcrumbItem } from '../lib/topic'; + +export interface Props { + breadcrumbs: BreadcrumbItem[]; + roadmapId: string; +} + +const { breadcrumbs, roadmapId } = Astro.props; +--- + +
+ + + + +

+ + ← Back to Topics List + +

+
\ No newline at end of file diff --git a/src/components/MarkdownContent/MarkdownContent.astro b/src/components/MarkdownContent/MarkdownContent.astro index 7dae2a1ce..4447ea8dd 100644 --- a/src/components/MarkdownContent/MarkdownContent.astro +++ b/src/components/MarkdownContent/MarkdownContent.astro @@ -3,7 +3,7 @@ import "./Prism.css"; ---
-
+
diff --git a/src/components/RoadmapBanner.astro b/src/components/RoadmapBanner.astro new file mode 100644 index 000000000..ff3e78c80 --- /dev/null +++ b/src/components/RoadmapBanner.astro @@ -0,0 +1,26 @@ +--- +import type { RoadmapFrontmatter } from '../lib/roadmap'; + +export interface Props { + roadmapId: string; + roadmap: RoadmapFrontmatter; +} + +const { roadmap, roadmapId } = Astro.props; +--- + + + + + Visit complete + + {roadmap.featuredTitle} roadmap + + diff --git a/src/lib/topic.ts b/src/lib/topic.ts index 893c1bece..cc6969b0b 100644 --- a/src/lib/topic.ts +++ b/src/lib/topic.ts @@ -59,7 +59,7 @@ function generateBreadcrumbs( return breadcrumbs; } -type BreadcrumbItem = { +export type BreadcrumbItem = { title: string; url: string; }; diff --git a/src/pages/[...topicId].astro b/src/pages/[...topicId].astro index 81d7d7187..6c4a334e9 100644 --- a/src/pages/[...topicId].astro +++ b/src/pages/[...topicId].astro @@ -1,13 +1,13 @@ --- +import Breadcrumbs from '../components/Breadcrumbs.astro'; import MarkdownContent from '../components/MarkdownContent/MarkdownContent.astro'; +import RoadmapBanner from '../components/RoadmapBanner.astro'; import BaseLayout from '../layouts/BaseLayout.astro'; import { getTopicFiles, TopicFileType } from '../lib/topic'; export async function getStaticPaths() { const topicPathMapping = await getTopicFiles(); - // console.log(topicPathMapping); - return Object.keys(topicPathMapping).map((topicSlug) => ({ params: { topicId: topicSlug.replace(/^\//, '') }, props: topicPathMapping[topicSlug], @@ -15,10 +15,13 @@ export async function getStaticPaths() { } const { topicId } = Astro.params; -const { file } = Astro.props as TopicFileType; +const { file, breadcrumbs, roadmapId, roadmap } = Astro.props as TopicFileType; --- + + +