|
| 1 | +import { Icon, type IconName } from "@/components/ui/icon"; |
| 2 | +import { BlockStack, InlineStack } from "@/components/ui/layout"; |
| 3 | +import { Link } from "@/components/ui/link"; |
| 4 | +import { Text } from "@/components/ui/typography"; |
| 5 | +import { DOCUMENTATION_URL } from "@/utils/constants"; |
| 6 | +import { tracking } from "@/utils/tracking"; |
| 7 | + |
| 8 | +interface QuickLink { |
| 9 | + id: string; |
| 10 | + label: string; |
| 11 | + href: string; |
| 12 | + icon: IconName; |
| 13 | +} |
| 14 | + |
| 15 | +const QUICK_LINKS: QuickLink[] = [ |
| 16 | + { |
| 17 | + id: "getting-started", |
| 18 | + label: "Getting started", |
| 19 | + href: `${DOCUMENTATION_URL}getting-started/first-pipeline/`, |
| 20 | + icon: "Rocket", |
| 21 | + }, |
| 22 | + { |
| 23 | + id: "components", |
| 24 | + label: "Components", |
| 25 | + href: `${DOCUMENTATION_URL}core-concepts/what-are-components/`, |
| 26 | + icon: "Package", |
| 27 | + }, |
| 28 | + { |
| 29 | + id: "pipelines", |
| 30 | + label: "Pipelines", |
| 31 | + href: `${DOCUMENTATION_URL}core-concepts/understanding-inputs-outputs/`, |
| 32 | + icon: "GitBranch", |
| 33 | + }, |
| 34 | + { |
| 35 | + id: "secrets", |
| 36 | + label: "Secrets & auth", |
| 37 | + href: `${DOCUMENTATION_URL}core-concepts/secrets/`, |
| 38 | + icon: "Lock", |
| 39 | + }, |
| 40 | + { |
| 41 | + id: "runs", |
| 42 | + label: "Running pipelines", |
| 43 | + href: `${DOCUMENTATION_URL}core-concepts/tasks-and-executions/`, |
| 44 | + icon: "Play", |
| 45 | + }, |
| 46 | + { |
| 47 | + id: "schema", |
| 48 | + label: "Schema reference", |
| 49 | + href: `${DOCUMENTATION_URL}reference/schema/`, |
| 50 | + icon: "Code", |
| 51 | + }, |
| 52 | +]; |
| 53 | + |
| 54 | +function QuickLinkPill({ link }: { link: QuickLink }) { |
| 55 | + return ( |
| 56 | + <a |
| 57 | + href={link.href} |
| 58 | + target="_blank" |
| 59 | + rel="noopener noreferrer" |
| 60 | + className="inline-flex items-center gap-1.5 px-3 py-1 rounded-full border border-border hover:border-primary/40 hover:bg-muted/40 transition-all no-underline" |
| 61 | + {...tracking("learning_hub.documentation.quick_link", { |
| 62 | + link_id: link.id, |
| 63 | + })} |
| 64 | + > |
| 65 | + <Icon |
| 66 | + name={link.icon} |
| 67 | + size="xs" |
| 68 | + className="text-muted-foreground shrink-0" |
| 69 | + aria-hidden="true" |
| 70 | + /> |
| 71 | + <Text size="sm" weight="semibold"> |
| 72 | + {link.label} |
| 73 | + </Text> |
| 74 | + </a> |
| 75 | + ); |
| 76 | +} |
| 77 | + |
| 78 | +export function DocsQuickLinks() { |
| 79 | + return ( |
| 80 | + <BlockStack gap="1"> |
| 81 | + <Text size="sm" weight="semibold" className="text-muted-foreground"> |
| 82 | + Quick links |
| 83 | + </Text> |
| 84 | + <InlineStack gap="2"> |
| 85 | + {QUICK_LINKS.map((link) => ( |
| 86 | + <QuickLinkPill key={link.id} link={link} /> |
| 87 | + ))} |
| 88 | + <Link |
| 89 | + href={DOCUMENTATION_URL} |
| 90 | + external |
| 91 | + variant="primary" |
| 92 | + size="sm" |
| 93 | + className="ml-1" |
| 94 | + {...tracking("learning_hub.documentation.full_docs")} |
| 95 | + > |
| 96 | + Full docs |
| 97 | + </Link> |
| 98 | + </InlineStack> |
| 99 | + </BlockStack> |
| 100 | + ); |
| 101 | +} |
0 commit comments