BuildBySection.tsx74 lines · main
1import { Book } from 'lucide-react'
2import Link from 'next/link'
3import { ComponentPropsWithoutRef, ElementRef, forwardRef, ReactNode } from 'react'
4import { cn } from 'ui'
5
6import { IntegrationDefinition } from '../Landing/Integrations.constants'
7
8interface BuiltBySectionProps extends ComponentPropsWithoutRef<'div'> {
9 integration: IntegrationDefinition
10 status?: string | ReactNode
11}
12
13export const BuiltBySection = forwardRef<ElementRef<'div'>, BuiltBySectionProps>(
14 ({ integration, status, className, ...props }, ref) => {
15 const { docsUrl } = integration
16 const { name, websiteUrl } = integration?.author ?? {}
17
18 if (!name && !docsUrl && !websiteUrl) return null
19
20 return (
21 <div
22 ref={ref}
23 className={cn('flex flex-wrap items-center gap-8 md:gap-10 px-4 md:px-10', className)}
24 {...props}
25 >
26 {status && (
27 <div>
28 <div className="text-foreground-lighter font-mono text-xs mb-1">STATUS</div>
29 <div>{status}</div>
30 </div>
31 )}
32 {name && (
33 <div>
34 <div className="text-foreground-lighter font-mono text-xs mb-1">BUILT BY</div>
35 <div className="text-foreground-light text-sm">{name}</div>
36 </div>
37 )}
38 {docsUrl && (
39 <div>
40 <div className="text-foreground-lighter font-mono text-xs mb-1">DOCS</div>
41 <Link
42 href={docsUrl}
43 target="_blank"
44 rel="noreferrer"
45 className="text-foreground-light hover:text-foreground text-sm flex items-center gap-2"
46 >
47 <Book size={16} />
48 {docsUrl.includes('supabase.com/docs')
49 ? 'Briven Docs'
50 : docsUrl.includes('github.com')
51 ? 'GitHub Docs'
52 : 'Documentation'}
53 </Link>
54 </div>
55 )}
56 {websiteUrl && (
57 <div>
58 <div className="text-foreground-lighter font-mono text-xs mb-1">WEBSITE</div>
59 <Link
60 href={websiteUrl}
61 target="_blank"
62 rel="noreferrer"
63 className="text-foreground-light hover:text-foreground text-sm"
64 >
65 {websiteUrl.replace('https://', '')}
66 </Link>
67 </div>
68 )}
69 </div>
70 )
71 }
72)
73
74BuiltBySection.displayName = 'BuiltBySection'