diff --git a/src/components/FeaturedItems/FeaturedItem.astro b/src/components/FeaturedItems/FeaturedItem.astro new file mode 100644 index 000000000..e4afd2332 --- /dev/null +++ b/src/components/FeaturedItems/FeaturedItem.astro @@ -0,0 +1,50 @@ +--- +export interface FeaturedItemType { + isUpcoming?: boolean; + isNew?: boolean; + url: string; + text: string; +} + +export interface Props extends FeaturedItemType {} + +const { isUpcoming = false, isNew = false, text, url } = Astro.props; +--- + + + + {text} + + + { + isNew && ( + + + + + + New + + ) + } + + { + isUpcoming && ( + + + + + + Upcoming + + ) + } + diff --git a/src/components/FeaturedItems/FeaturedItems.astro b/src/components/FeaturedItems/FeaturedItems.astro new file mode 100644 index 000000000..867170151 --- /dev/null +++ b/src/components/FeaturedItems/FeaturedItems.astro @@ -0,0 +1,35 @@ +--- +import FeaturedItem, { FeaturedItemType } from './FeaturedItem.astro'; + +export interface Props { + featuredItems: FeaturedItemType[]; + heading: string; +} + +const { featuredItems, heading } = Astro.props; +--- + +
+
+ + + +
+
diff --git a/src/components/FeaturedRoadmaps/FeaturedRoadmapItem.astro b/src/components/FeaturedRoadmaps/FeaturedRoadmapItem.astro deleted file mode 100644 index 0c729fae5..000000000 --- a/src/components/FeaturedRoadmaps/FeaturedRoadmapItem.astro +++ /dev/null @@ -1,56 +0,0 @@ ---- -import type { RoadmapFileType } from '../../lib/roadmap'; - -export interface Props { - roadmap: RoadmapFileType; -} - -const { roadmap } = Astro.props; -const frontmatter = roadmap.frontmatter; - -let roadmapTitle = frontmatter.featuredTitle; - -// Lighthouse considers "Go" as a non-descriptive text such as "Submit" etc. -// Adding "Roadmap" as a postfix to make it not complain ¯\_(ツ)_/¯ -if (roadmapTitle === 'Go') { - roadmapTitle = 'Go Roadmap'; -} ---- - - - - {roadmapTitle} - - - { - frontmatter.isNew && ( - - - - - - New - - ) - } - - { - frontmatter.isUpcoming && ( - - - - - - Upcoming - - ) - } - diff --git a/src/components/FeaturedRoadmaps/FeaturedRoadmaps.astro b/src/components/FeaturedRoadmaps/FeaturedRoadmaps.astro deleted file mode 100644 index 39317ec20..000000000 --- a/src/components/FeaturedRoadmaps/FeaturedRoadmaps.astro +++ /dev/null @@ -1,31 +0,0 @@ ---- -import type { RoadmapFileType } from '../../lib/roadmap'; -import FeaturedRoadmapItem from './FeaturedRoadmapItem.astro'; - -export interface Props { - roadmaps: RoadmapFileType[]; - heading: string; -} - -const { roadmaps, heading } = Astro.props; ---- - -
-
- - - -
-
diff --git a/src/pages/index.astro b/src/pages/index.astro index 201a56308..082531dff 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,6 +1,6 @@ --- import FeaturedGuides from '../components/FeaturedGuides.astro'; -import FeaturedRoadmaps from '../components/FeaturedRoadmaps/FeaturedRoadmaps.astro'; +import FeaturedItems from '../components/FeaturedItems/FeaturedItems.astro'; import FeaturedVideos from '../components/FeaturedVideos.astro'; import BaseLayout from '../layouts/BaseLayout.astro'; import { getAllGuides } from '../lib/guide'; @@ -13,12 +13,14 @@ const guides = await getAllGuides(); const videos = await getAllVideos(); --- - +
-
+

@@ -26,20 +28,35 @@ const videos = await getAllVideos();

- Community created roadmaps, guides and articles to help developers - grow in their career. + Community created roadmaps, guides and articles to help developers grow in their career.

- - + ({ + text: roadmapItem.frontmatter.featuredTitle, + url: `/${roadmapItem.id}/`, + isNew: roadmapItem.frontmatter.isNew, + isUpcoming: roadmapItem.frontmatter.isUpcoming, + }))} + /> + + ({ + text: roadmapItem.frontmatter.featuredTitle === 'Go' ? 'Go Roadmap' : roadmapItem.frontmatter.featuredTitle, + url: `/${roadmapItem.id}/`, + isNew: roadmapItem.frontmatter.isNew, + isUpcoming: roadmapItem.frontmatter.isUpcoming, + }))} + />