Files
supabase/apps/www/components/Sections/CustomerQuotesSection.tsx
Brian-AnandDanny White f1082e28c7 chore: migrate Framer Motion imports to Motion (#51520)
## Problem

Closes #31221.
The applications and shared UI packages still import the former
`framer-motion` package instead of Motion's React entry point.

## Solution

Replace runtime imports, type imports, and three test mocks with
`motion/react` across the consuming workspaces.
Replace the seven direct dependency declarations with `motion:
^11.18.2`.
Preserve the existing animation engine version and all other dependency
resolutions, including the asynchronous `domMax` feature loader.
Historical blog examples remain as published; `framer-motion` remains a
transitive implementation dependency of Motion.

## Review instructions

1. Run `pnpm install --frozen-lockfile` and check the seven dependency
replacements in the lockfile.
2. Open the WWW Auth page and Docs homepage at desktop and mobile
widths, with normal and reduced motion preferences.
3. Open the mobile navigation, expand Product on WWW, and close the menu
using Escape and the close button.
4. Check the existing animation components, shared form validation, and
Studio tests for unchanged behavior.

Validation:

- Studio: 731 test files, 8,334 passing tests and one expected failure,
with `--maxWorkers=4`.
- Shared UI, UI patterns, WWW, and UI library: 615 passing tests.
- `pnpm run typecheck --concurrency=1`: all 16 repository tasks pass.
- All six application source lint scripts and lint ratchets pass;
generated Docs example copies are excluded from local lint.
- Repository Prettier source check, lockfile formatting, and case hazard
check pass.
- WWW: 10 existing end-to-end checks across nine pages.
- Docs: 5 existing guide link and accessibility checks across Database
and Auth.
- WWW and Docs mobile navigation pass at desktop/mobile sizes with
normal/reduced motion; SQL-to-REST translation tabs exercise the
asynchronous feature loader without browser errors.
- Frozen-lockfile installation passes; all existing package and snapshot
resolutions are unchanged.
- Learn and UI library command palettes open, filter results, and close
with Escape without browser errors.
- Independent code review finds no actionable defects.
- `npm run build -- --filter=www --filter=docs --filter=studio
--filter=learn --filter=library --concurrency=1 --continue=always`: all
five affected applications build successfully (9 tasks including
prerequisites); asset uploads disabled for local validation.

## Checklist

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [x] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)
(no docs topics changed)

---------

Co-authored-by: Danny White <3104761+dnywh@users.noreply.github.com>
2026-10-14 07:16:00 +00:00

120 lines
3.7 KiB
TypeScript

import SectionContainer from '~/components/Layouts/SectionContainer'
import CustomersVisual from '~/components/Products/VectorAI/CustomersVisual'
import { getAnimation, INITIAL_BOTTOM } from '~/lib/animations'
import { ArrowUpRight } from 'lucide-react'
import { domAnimation, LazyMotion, m, useInView } from 'motion/react'
import { useTheme } from 'next-themes'
import Image from 'next/image'
import Link from 'next/link'
import { useRouter } from 'next/router'
import { useRef } from 'react'
interface Customer {
type?: string
avatar?: string
author?: string
role?: string
target?: string
quote?: string | React.ReactNode
abstract?: string
image?: string
url?: string
logo?: string
customer?: string
}
interface Card {
customer: any
index: number
}
interface Props {
title: string | React.ReactNode
customers: Customer[]
}
const CustomerQuotesSection = (props: Props) => {
const { basePath } = useRouter()
const ref = useRef(null)
const isInView = useInView(ref, { margin: '-25%', once: true })
const Card = ({ customer, index }: Card) => {
const { resolvedTheme } = useTheme()
const logo = `/images/customers/logos/${!resolvedTheme?.includes('dark') ? 'on-light/' : 'on-dark/'}${
customer.customer
}.png`
const initial = INITIAL_BOTTOM
const animate = getAnimation({ delay: index * 0.1 })
return (
<m.div
initial={initial}
animate={isInView ? animate : initial}
className="bg-background hover:border-control border-background-overlay-default rounded-2xl border p-6 drop-shadow-xs flex flex-col justify-between"
>
<div className="flex flex-col gap-4">
<div className="h-24 w-full flex items-center justify-center pb-3">
<div className="relative w-full flex items-center justify-center h-10">
<Image
src={logo}
alt={`Supabase + ${customer.customer}`}
layout="fill"
objectFit="contain"
objectPosition="center"
/>
</div>
</div>
<div className="border-t pt-4">
<blockquote className="text-foreground-light text-base">{customer.quote}</blockquote>
</div>
</div>
<div>
<p className="text-foreground-lighter mt-4">
{customer.author}, {customer.role}
</p>
{customer.url && (
<div className="text-primary border-t mt-4 pt-4 cursor-pointer text-sm flex items-center justify-between">
<span>Read Customer Story</span>
<ArrowUpRight />
</div>
)}
</div>
</m.div>
)
}
return (
<LazyMotion features={domAnimation}>
<div className="py-16 sm:py-18 md:py-24 overflow-hidden">
<div className="relative h-[300px] w-[300vw] left-[-98vw] md:left-0 mx-auto md:w-full -mb-32 z-0">
<CustomersVisual />
</div>
<SectionContainer className="py-0!">
<div className="col-span-12 text-center relative z-10">
<h3 className="text-3xl md:text-4xl heading-gradient">{props.title}</h3>
</div>
<div
ref={ref}
className="relative mx-auto max-w-7xl grid grid-cols-1 lg:grid-cols-3 gap-4 xl:gap-8 pt-16 pb-0"
>
{props.customers.map((customer, i: number) => (
<Link
href={`${basePath}${customer.url}`}
key={customer.customer}
className="h-full flex"
target={customer.target ?? '_self'}
>
<Card customer={customer} index={i} />
</Link>
))}
</div>
</SectionContainer>
</div>
</LazyMotion>
)
}
export default CustomerQuotesSection