mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-08-30 12:40:03 +02:00
Add questions on homepage
This commit is contained in:
@@ -6,11 +6,18 @@ export interface FeaturedItemType {
|
||||
isNew?: boolean;
|
||||
url: string;
|
||||
text: string;
|
||||
allowBookmark?: boolean;
|
||||
}
|
||||
|
||||
export interface Props extends FeaturedItemType {}
|
||||
|
||||
const { isUpcoming = false, isNew = false, text, url } = Astro.props;
|
||||
const {
|
||||
isUpcoming = false,
|
||||
isNew = false,
|
||||
text,
|
||||
url,
|
||||
allowBookmark = true,
|
||||
} = Astro.props;
|
||||
---
|
||||
|
||||
<a
|
||||
@@ -26,11 +33,17 @@ const { isUpcoming = false, isNew = false, text, url } = Astro.props;
|
||||
{text}
|
||||
</span>
|
||||
|
||||
<MarkFavorite
|
||||
resourceId={url.split('/').pop()!}
|
||||
resourceType={url.includes('best-practices') ? 'best-practice' : 'roadmap'}
|
||||
client:only="react"
|
||||
/>
|
||||
{
|
||||
allowBookmark && (
|
||||
<MarkFavorite
|
||||
resourceId={url.split('/').pop()!}
|
||||
resourceType={
|
||||
url.includes('best-practices') ? 'best-practice' : 'roadmap'
|
||||
}
|
||||
client:only='react'
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
{
|
||||
isNew && (
|
||||
|
@@ -4,15 +4,16 @@ import FeaturedItem, { FeaturedItemType } from './FeaturedItem.astro';
|
||||
export interface Props {
|
||||
featuredItems: FeaturedItemType[];
|
||||
heading: string;
|
||||
allowBookmark?: boolean;
|
||||
}
|
||||
|
||||
const { featuredItems, heading } = Astro.props;
|
||||
const { featuredItems, heading, allowBookmark = true } = Astro.props;
|
||||
---
|
||||
|
||||
<div class='relative border-b border-b-[#1e293c] py-10 sm:py-14'>
|
||||
<div class='container'>
|
||||
<h2
|
||||
class='text-md font-regular absolute flex rounded-lg border border-[#1e293c] bg-slate-900 px-3 py-1 text-slate-400 -top-[17px] sm:left-1/2 sm:-translate-x-1/2'
|
||||
class='text-md font-regular absolute -top-[17px] flex rounded-lg border border-[#1e293c] bg-slate-900 px-3 py-1 text-slate-400 sm:left-1/2 sm:-translate-x-1/2'
|
||||
>
|
||||
{heading}
|
||||
</h2>
|
||||
@@ -22,6 +23,7 @@ const { featuredItems, heading } = Astro.props;
|
||||
featuredItems.map((featuredItem) => (
|
||||
<li>
|
||||
<FeaturedItem
|
||||
allowBookmark={allowBookmark}
|
||||
text={featuredItem.text}
|
||||
url={featuredItem.url}
|
||||
isNew={featuredItem.isNew}
|
||||
|
@@ -8,10 +8,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';
|
||||
|
||||
const roleRoadmaps = await getRoadmapsByTag('role-roadmap');
|
||||
const skillRoadmaps = await getRoadmapsByTag('skill-roadmap');
|
||||
const bestPractices = await getAllBestPractices();
|
||||
const questionGroups = await getAllQuestionGroups();
|
||||
|
||||
const guides = await getAllGuides();
|
||||
const videos = await getAllVideos();
|
||||
@@ -58,6 +60,16 @@ const videos = await getAllVideos();
|
||||
}))}
|
||||
/>
|
||||
|
||||
<!--<FeaturedItems-->
|
||||
<!-- heading='Questions'-->
|
||||
<!-- allowBookmark={false}-->
|
||||
<!-- featuredItems={questionGroups.map((questionGroup) => ({-->
|
||||
<!-- text: questionGroup.frontmatter.briefTitle,-->
|
||||
<!-- url: `/questions/${questionGroup.id}`,-->
|
||||
<!-- isNew: questionGroup.frontmatter.isNew,-->
|
||||
<!-- }))}-->
|
||||
<!--/>-->
|
||||
|
||||
<div class='grid grid-cols-1 gap-7 bg-gray-50 py-7 sm:gap-16 sm:py-16'>
|
||||
<FeaturedGuides heading='Guides' guides={guides.slice(0, 7)} />
|
||||
<FeaturedVideos heading='Videos' videos={videos.slice(0, 7)} />
|
||||
|
Reference in New Issue
Block a user