BuildBySection.tsx 2.3 KB

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