From 3166a02f235b82309541e90b4a949fcf1358e342 Mon Sep 17 00:00:00 2001 From: Arik Chakma Date: Mon, 23 Sep 2024 18:46:37 +0600 Subject: [PATCH] feat: implement roadmap alert (#7116) * feat: implement roadmap alert * fix: floating icon position --- .../CustomRoadmap/CustomRoadmapAlert.tsx | 38 ++++------ .../GenerateRoadmap/AIRoadmapAlert.tsx | 59 +++++----------- src/components/RoadmapAlert.tsx | 70 +++++++++++++++++++ 3 files changed, 99 insertions(+), 68 deletions(-) create mode 100644 src/components/RoadmapAlert.tsx diff --git a/src/components/CustomRoadmap/CustomRoadmapAlert.tsx b/src/components/CustomRoadmap/CustomRoadmapAlert.tsx index 95fbc0b47..a68d69c92 100644 --- a/src/components/CustomRoadmap/CustomRoadmapAlert.tsx +++ b/src/components/CustomRoadmap/CustomRoadmapAlert.tsx @@ -10,6 +10,7 @@ import { showLoginPopup } from '../../lib/popup.ts'; import { isLoggedIn } from '../../lib/jwt.ts'; import { useState } from 'react'; import { CreateRoadmapModal } from './CreateRoadmap/CreateRoadmapModal.tsx'; +import { RoadmapAlert } from '../RoadmapAlert.tsx'; export function CustomRoadmapAlert() { const [isCreatingRoadmap, setIsCreatingRoadmap] = useState(false); @@ -23,33 +24,18 @@ export function CustomRoadmapAlert() { }} /> )} -
-

- This is a custom roadmap made by a community member and is not - verified by roadmap.sh -

-
- - - Visit Official Roadmaps - - - · - - - - More Community Roadmaps - -
- -
+ + This is a custom roadmap made by a community member and is not + verified by roadmap.sh + + } + floatingIcon={MessageCircleHeart} + className="mb-5 mt-0 sm:-mt-6 sm:mb-7" + /> ); } diff --git a/src/components/GenerateRoadmap/AIRoadmapAlert.tsx b/src/components/GenerateRoadmap/AIRoadmapAlert.tsx index 4a76c9d7d..f03e20e97 100644 --- a/src/components/GenerateRoadmap/AIRoadmapAlert.tsx +++ b/src/components/GenerateRoadmap/AIRoadmapAlert.tsx @@ -1,4 +1,5 @@ -import { BadgeCheck, Telescope, Wand } from 'lucide-react'; +import { BadgeCheck, Bot, Telescope, Wand } from 'lucide-react'; +import { RoadmapAlert } from '../RoadmapAlert'; type AIRoadmapAlertProps = { isListing?: boolean; @@ -8,46 +9,20 @@ export function AIRoadmapAlert(props: AIRoadmapAlertProps) { const { isListing = false } = props; return ( -
-

- AI Generated Roadmap{isListing ? 's' : ''}{' '} - - Beta - -

-

- {isListing - ? 'These are AI generated roadmaps and are not verified by' - : 'This is an AI generated roadmap and is not verified by'}{' '} - roadmap.sh. We are currently in - beta and working hard to improve the quality of the generated roadmaps. -

-

- {isListing ? ( - - - Create your own Roadmap with AI - - ) : ( - - - Explore other AI Roadmaps - - )} - - - Visit Official Roadmaps - -

-
+ + {isListing + ? 'These are AI generated roadmaps and are not verified by' + : 'This is an AI generated roadmap and is not verified by'}{' '} + roadmap.sh. We are currently + in beta and working hard to improve the quality of the generated + roadmaps. + + } + floatingIcon={Bot} + /> ); } diff --git a/src/components/RoadmapAlert.tsx b/src/components/RoadmapAlert.tsx new file mode 100644 index 000000000..d8e8e1512 --- /dev/null +++ b/src/components/RoadmapAlert.tsx @@ -0,0 +1,70 @@ +import { + BadgeCheck, + HeartHandshake, + Telescope, + type LucideIcon, +} from 'lucide-react'; +import type { ReactNode } from 'react'; +import { cn } from '../lib/classname'; + +type RoadmapAlertProps = { + title: string; + badgeText?: string; + description: string | ReactNode; + floatingIcon: LucideIcon; + className?: string; +}; + +export function RoadmapAlert(props: RoadmapAlertProps) { + const { + title, + badgeText, + description, + floatingIcon: FloatingIcon, + className, + } = props; + + return ( +
+

+ {title}{' '} + {badgeText && ( + + {badgeText} + + )} +

+

{description}

+

+ + + Visit Official Roadmaps + + + + Explore Community Roadmaps + + + + Explore other AI Roadmaps + +

+ + +
+ ); +}