parent
3ce92af265
commit
3d72c49c3f
9 changed files with 251 additions and 99 deletions
@ -0,0 +1,33 @@ |
||||
import { type LucideIcon, Star } from 'lucide-react'; |
||||
import { cn } from '../../lib/classname.ts'; |
||||
|
||||
type ResourceSeparatorProps = { |
||||
text: string; |
||||
className?: string; |
||||
labelClassName?: string; |
||||
icon?: LucideIcon; |
||||
}; |
||||
|
||||
export function ResourceListSeparator(props: ResourceSeparatorProps) { |
||||
const { text, icon: Icon, className = '', labelClassName = '' } = props; |
||||
|
||||
return ( |
||||
<p |
||||
className={cn( |
||||
'relative mt-6 flex items-center justify-start text-purple-600', |
||||
className, |
||||
)} |
||||
> |
||||
<span |
||||
className={cn( |
||||
'relative left-3 z-50 inline-flex items-center gap-1 rounded-md border border-current bg-white px-2 py-0.5 text-xs font-medium', |
||||
labelClassName, |
||||
)} |
||||
> |
||||
{Icon && <Icon className="inline-block h-3 w-3 fill-current" />} |
||||
{text} |
||||
</span> |
||||
<hr className="absolute inset-x-0 flex-grow border-current" /> |
||||
</p> |
||||
); |
||||
} |
@ -0,0 +1,57 @@ |
||||
import { cn } from '../../lib/classname.ts'; |
||||
import type { AllowedLinkTypes } from '../CustomRoadmap/CustomRoadmap.tsx'; |
||||
|
||||
const linkTypes: Record<AllowedLinkTypes, string> = { |
||||
article: 'bg-yellow-300', |
||||
course: 'bg-green-400', |
||||
opensource: 'bg-black text-white', |
||||
'roadmap.sh': 'bg-black text-white', |
||||
roadmap: 'bg-black text-white', |
||||
podcast: 'bg-purple-300', |
||||
video: 'bg-purple-300', |
||||
website: 'bg-blue-300', |
||||
official: 'bg-blue-600 text-white', |
||||
feed: 'bg-[#ce3df3] text-white', |
||||
}; |
||||
|
||||
const paidLinkTypes: Record<string, string> = { |
||||
course: 'bg-yellow-300', |
||||
}; |
||||
|
||||
type TopicDetailLinkProps = { |
||||
url: string; |
||||
onClick?: () => void; |
||||
type: AllowedLinkTypes; |
||||
title: string; |
||||
isPaid?: boolean; |
||||
}; |
||||
|
||||
export function TopicDetailLink(props: TopicDetailLinkProps) { |
||||
const { url, onClick, type, title, isPaid = false } = props; |
||||
|
||||
return ( |
||||
<a |
||||
href={url} |
||||
target="_blank" |
||||
className="group font-medium text-gray-800 underline underline-offset-1 hover:text-black" |
||||
onClick={onClick} |
||||
> |
||||
<span |
||||
className={cn( |
||||
'mr-2 inline-block rounded px-1.5 py-0.5 text-xs uppercase no-underline', |
||||
(isPaid ? paidLinkTypes[type] : linkTypes[type]) || 'bg-gray-200', |
||||
)} |
||||
> |
||||
{type === 'opensource' ? ( |
||||
<> |
||||
{url.includes('github') && 'GitHub'} |
||||
{url.includes('gitlab') && 'GitLab'} |
||||
</> |
||||
) : ( |
||||
type |
||||
)} |
||||
</span> |
||||
{title} |
||||
</a> |
||||
); |
||||
} |
Loading…
Reference in new issue