'use client' import SectionContainer from '~/components/Layouts/SectionContainer' import Panel from '~/components/Panel' import type { CustomerStoryType } from '~/data/CustomerStories' import customerStories from '~/data/CustomerStories' import { useSendTelemetryEvent } from '~/lib/telemetry' import SectionHeader from 'components/UI/SectionHeader' import { ArrowRight } from 'lucide-react' import { useTheme } from 'next-themes' import dynamic from 'next/dynamic' import Image from 'next/image' import Link from 'next/link' import { PropsWithChildren } from 'react' import { Button, cn } from 'ui' const CustomersSliderMobile = dynamic(() => import('./CustomersSliderMobile')) const CutomsersSliderDesktop = dynamic(() => import('./CutomsersSliderDesktop')) const CustomerStories = () => (
) /** * Utils & Components */ const getCustomer: (customer: string, linked: boolean) => ExtendedCustomerStoryType = ( customer, linked ) => ({ ...customerStories.find((story: CustomerStoryType) => customer.includes(story.organization!))!, linked, }) const compositionCols: CompositionColType[] = [ { type: 'narrow', cards: [getCustomer('Quivr', false), getCustomer('Tinloof', false)], }, { type: 'narrow', cards: [ { logo: '/images/customers/logos/on-light/1password.png', logo_inverse: '/images/customers/logos/on-dark/1password.png', organization: '1Password', }, getCustomer('Next Door Lending', true), ], }, { type: 'expanded', cards: [getCustomer('Maergo', true)], }, { type: 'narrow', cards: [ getCustomer('Shotgun', true), { logo: '/images/customers/logos/on-light/mozilla.png', logo_inverse: '/images/customers/logos/on-dark/mozilla.png', organization: 'Mozilla', linked: false, }, ], }, { type: 'expanded', cards: [getCustomer('Chatbase', true)], }, { type: 'narrow', cards: [getCustomer('Mobbin', true), getCustomer('HappyTeams', true)], }, { type: 'expanded', cards: [getCustomer('Pebblely', true)], }, ] export const CompositionCol: React.FC = ({ column, className }) => { const sendTelemetryEvent = useSendTelemetryEvent() return (
{column.cards.map((customer) => column.type === 'expanded' ? ( sendTelemetryEvent({ action: 'homepage_customer_story_card_clicked', properties: { customer: customer.organization }, }) } > ) : customer.linked ? ( sendTelemetryEvent({ action: 'homepage_customer_story_card_clicked', properties: { customer: customer.organization }, }) } > ) : ( ) )}
) } const CustomerCard: React.FC = ({ customer, className, size, children, ...rest }) => { const { resolvedTheme } = useTheme() const showLogoInverse = customer.logo_inverse && resolvedTheme?.includes('dark') const showLogo = !showLogoInverse && customer.logo const LogoComponent = ({ logoImage, className }: { logoImage: string; className?: string }) => (
{customer.title!}
) switch (size) { case 'narrow': return ( {customer.organization!} ) case 'expanded': return ( {showLogoInverse && } {showLogo && }

{customer.title}

{children && {children}}
) } } /** Types */ type ColSize = 'narrow' | 'expanded' type ExtendedCustomerStoryType = Partial & { linked?: boolean } export type CompositionColType = { type: ColSize cards: ExtendedCustomerStoryType[] } interface CompositionColProps { column: CompositionColType className?: string } interface CustomerCardProps extends PropsWithChildren { customer: ExtendedCustomerStoryType className?: string size?: ColSize } export default CustomerStories