Files
supabase/apps/www/pages/customers.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

189 lines
6.3 KiB
TypeScript

import fs from 'fs'
import DefaultLayout from '~/components/Layouts/Default'
import { getSortedPosts } from '~/lib/posts'
import { generateRss } from '~/lib/rss'
import styles from '~/styles/customers.module.css'
import type PostTypes from '~/types/post'
import { motion } from 'motion/react'
import { NextSeo } from 'next-seo'
import Head from 'next/head'
import Link from 'next/link'
import { useRouter } from 'next/router'
import { useState } from 'react'
import { Button, cn } from 'ui'
import { GlassPanel } from 'ui-patterns/GlassPanel'
import CustomersFilters from '../components/CustomerStories/CustomersFilters'
import SectionContainer from '../components/Layouts/SectionContainer'
import { breadcrumbs } from '@/lib/breadcrumbs'
import { breadcrumbListSchema, serializeJsonLd } from '@/lib/json-ld'
export async function getStaticProps() {
const allPostsData: any[] = getSortedPosts({ directory: '_customers' })
const rss = generateRss(allPostsData)
// create a rss feed in public directory
// rss feed is added via <Head> component in render return
fs.writeFileSync('./public/customers-rss.xml', rss)
const industries = allPostsData.reduce<{ [key: string]: number }>(
(acc, customer) => {
// Increment the 'all' counter
acc.all = (acc.all || 0) + 1
// Increment the counter for each category
customer.industry?.forEach((industry: string) => {
acc[industry] = (acc[industry] || 0) + 1
})
return acc
},
{ all: 0 }
)
const products = allPostsData.reduce<{ [key: string]: number }>(
(acc, customer) => {
// Increment the 'all' counter
acc.all = (acc.all || 0) + 1
// Increment the counter for each category
customer.supabase_products?.forEach((product: string) => {
acc[product] = (acc[product] || 0) + 1
})
return acc
},
{ all: 0 }
)
return {
props: {
blogs: allPostsData,
industries,
products,
},
}
}
function CustomerStoriesPage(props: any) {
const { basePath } = useRouter()
const _allCustomers = props.blogs?.map((blog: PostTypes, idx: number) => {
return {
logo: blog.logo,
logoInverse: blog.logo_inverse,
name: blog.name,
title: blog.title,
link: blog.url,
industry: blog.industry,
products: blog.supabase_products,
}
})
const [customers, setCustomers] = useState(_allCustomers)
const meta = {
title: 'Customer Stories | Supabase',
image: `${basePath}/images/customers/og/customer-stories.jpg`,
description:
'See how Supabase empowers companies of all sizes to accelerate their growth and streamline their work.',
}
return (
<>
<Head>
<title>{meta.title}</title>
<meta name="description" content={meta.description} />
<meta property="og:image" content={meta.image} />
<meta name="twitter:image" content={meta.image} />
<link
rel="alternate"
type="application/rss+xml"
title="RSS feed for customer stories"
href={`${basePath}/customers-rss.xml`}
/>
<script
type="application/ld+json"
dangerouslySetInnerHTML={{
__html: serializeJsonLd(breadcrumbListSchema(breadcrumbs.customersIndex)),
}}
/>
</Head>
<NextSeo
title={meta.title}
description={meta.description}
openGraph={{
title: meta.title,
description: meta.description,
url: `${basePath}/customers`,
images: [
{
url: meta.image,
},
],
}}
/>
<DefaultLayout>
<div className="relative z-0 bg-background overflow-hidden">
<SectionContainer className="pt-0! pb-0! mt-28 sm:mt-44">
<div className="mx-auto relative z-10">
<motion.div
className="mx-auto sm:max-w-2xl text-center flex flex-col items-center mb-12"
initial={{ opacity: 0, y: 10 }}
animate={{ opacity: 1, y: 0, transition: { duration: 0.5, easing: 'easeOut' } }}
>
<h1 className="text-foreground mb-3 text-3xl">Customer stories</h1>
<h2 className="text-foreground-light text-base sm:text-xl">
Discover case studies on how Supabase is being used around the world to quickly
create outstanding products and set new industry standards.
</h2>
</motion.div>
<CustomersFilters
allCustomers={_allCustomers}
setCustomers={setCustomers}
industries={props.industries}
products={props.products}
/>
<div className="mx-auto mt-4 sm:mt-6 mb-12 md:mb-20 grid grid-cols-12 gap-6 not-prose">
{customers?.length ? (
customers?.map((caseStudy: any, i: number) => (
<Link href={`${caseStudy.link}`} key={caseStudy.title} passHref legacyBehavior>
<motion.a
className="col-span-12 md:col-span-4"
initial={{ opacity: 0, y: 20 }}
animate={{
opacity: 1,
y: 0,
transition: {
duration: 0.4,
ease: [0.24, 0.25, 0.05, 1],
delay: 0.2 + i / 15,
},
}}
>
<GlassPanel {...caseStudy} showIconBg={true} showLink={true} hasLightIcon>
{caseStudy.description}
</GlassPanel>
</motion.a>
</Link>
))
) : (
<div className="col-span-12 flex flex-col gap-2 py-4 text-sm text-muted">
<p>No customers found</p>
</div>
)}
</div>
</div>
</SectionContainer>
<div
className={cn(
'absolute inset-0 h-[150px] sm:h-[300px] bg-background z-0 after:bg-background!',
styles['bg-visual']
)}
/>
</div>
</DefaultLayout>
</>
)
}
export default CustomerStoriesPage