From 5a4d1220fe03317ea6f8e2de97cc00564b7aa65e Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Mon, 5 Aug 2024 14:48:16 +0100 Subject: [PATCH] Add empty projects listing and cards --- src/components/Badge.tsx | 25 ++++++ src/components/Projects/EmptyProjects.tsx | 2 +- src/components/Projects/ProjectCard.tsx | 19 +++++ src/components/Projects/ProjectsList.tsx | 95 +++++++++++++++++++++++ src/pages/[roadmapId]/projects.astro | 21 +++-- 5 files changed, 154 insertions(+), 8 deletions(-) create mode 100644 src/components/Badge.tsx create mode 100644 src/components/Projects/ProjectCard.tsx create mode 100644 src/components/Projects/ProjectsList.tsx diff --git a/src/components/Badge.tsx b/src/components/Badge.tsx new file mode 100644 index 000000000..835f726f6 --- /dev/null +++ b/src/components/Badge.tsx @@ -0,0 +1,25 @@ +type BadgeProps = { + variant: 'blue' | 'green' | 'red' | 'yellow' | 'grey' | 'white'; + text: string; +}; + +export function Badge(type: BadgeProps) { + const { variant, text } = type; + + const colors = { + blue: 'bg-blue-100 text-blue-700', + green: 'bg-green-100 text-green-700', + red: 'bg-red-100 text-red-700', + yellow: 'bg-yellow-100 text-yellow-700', + grey: 'bg-gray-100 text-gray-700', + white: 'bg-white text-black', + }; + + return ( + + {text} + + ); +} diff --git a/src/components/Projects/EmptyProjects.tsx b/src/components/Projects/EmptyProjects.tsx index 9a28bfc7b..2a60eceb8 100644 --- a/src/components/Projects/EmptyProjects.tsx +++ b/src/components/Projects/EmptyProjects.tsx @@ -15,7 +15,7 @@ export function EmptyProjects() { }, []); return ( -
+

Projects are coming soon! diff --git a/src/components/Projects/ProjectCard.tsx b/src/components/Projects/ProjectCard.tsx new file mode 100644 index 000000000..488f8c1ce --- /dev/null +++ b/src/components/Projects/ProjectCard.tsx @@ -0,0 +1,19 @@ +import { Badge } from '../Badge.tsx'; + +export function ProjectCard() { + return ( + + + + + + Bank Application + + Create a simple CLI to collect and calculate the taxes. + + + ); +} diff --git a/src/components/Projects/ProjectsList.tsx b/src/components/Projects/ProjectsList.tsx new file mode 100644 index 000000000..15ea3de66 --- /dev/null +++ b/src/components/Projects/ProjectsList.tsx @@ -0,0 +1,95 @@ +import { ProjectCard } from './ProjectCard.tsx'; +import { Diff, HeartHandshake } from 'lucide-react'; +import { cn } from '../../lib/classname.ts'; +import { useState } from 'react'; + +type DifficultyButtonProps = { + difficulty: 'beginner' | 'intermediate' | 'senior'; + isActive?: boolean; + onClick?: () => void; +}; + +function DifficultyButton(props: DifficultyButtonProps) { + const { difficulty, onClick, isActive } = props; + + return ( + + ); +} + +export function ProjectsList() { + const [difficulty, setDifficulty] = useState< + 'beginner' | 'intermediate' | 'senior' + >(); + + return ( +
+
+
+ { + setDifficulty('beginner'); + }} + difficulty={'beginner'} + isActive={difficulty === 'beginner'} + /> + { + setDifficulty('intermediate'); + }} + difficulty={'intermediate'} + isActive={difficulty === 'intermediate'} + /> + { + setDifficulty('senior'); + }} + difficulty={'senior'} + isActive={difficulty === 'senior'} + /> +
+ + + Submit a Project Idea + +
+
+ + + + + + + + + + + + + + + + + + + + + +
+
+ ); +} diff --git a/src/pages/[roadmapId]/projects.astro b/src/pages/[roadmapId]/projects.astro index ed4e404d9..05c7eef5b 100644 --- a/src/pages/[roadmapId]/projects.astro +++ b/src/pages/[roadmapId]/projects.astro @@ -6,6 +6,7 @@ import RelatedRoadmaps from '../../components/RelatedRoadmaps.astro'; import RoadmapHeader from '../../components/RoadmapHeader.astro'; import { FolderKanbanIcon } from 'lucide-react'; import { EmptyProjects } from '../../components/Projects/EmptyProjects'; +import { ProjectsList } from '../../components/Projects/ProjectsList'; import ShareIcons from '../../components/ShareIcons/ShareIcons.astro'; import { TopicDetail } from '../../components/TopicDetail/TopicDetail'; import { UserProgressModal } from '../../components/UserProgress/UserProgressModal'; @@ -46,6 +47,15 @@ const ogImageUrl = group: 'roadmap', resourceId: roadmapId, }); + +const projects = ['a']; + +const descriptionNoun = { + 'AI and Data Scientist': 'AI and Data Science', + 'Game Developer': 'Game Development', + 'Technical Writer': 'Technical Writing', + 'Product Manager': 'Product Management', +}; ---
-
- -
+ {projects.length === 0 && } + {projects.length > 0 && }