mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
## 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>
126 lines
3.5 KiB
TypeScript
126 lines
3.5 KiB
TypeScript
import SectionContainer from '~/components/Layouts/SectionContainer'
|
|
import { getAnimation, INITIAL_BOTTOM } from '~/lib/animations'
|
|
import { ArrowUpRight } from 'lucide-react'
|
|
import { domAnimation, LazyMotion, m, useInView } from 'motion/react'
|
|
import Link from 'next/link'
|
|
import { ReactNode, useRef } from 'react'
|
|
import ReactMarkdown from 'react-markdown'
|
|
import { Button, cn } from 'ui'
|
|
|
|
interface Feature {
|
|
icon: string
|
|
title: string
|
|
text: string
|
|
}
|
|
interface Props {
|
|
id?: string
|
|
title: string | ReactNode
|
|
paragraph: string
|
|
cta?: {
|
|
label?: string
|
|
link: string
|
|
}
|
|
features?: Feature[]
|
|
className?: string
|
|
hasStickyTitle?: boolean
|
|
}
|
|
|
|
const FeaturesSection = ({
|
|
id,
|
|
title,
|
|
paragraph,
|
|
cta,
|
|
features,
|
|
className,
|
|
hasStickyTitle,
|
|
}: Props) => {
|
|
const ref = useRef(null)
|
|
const isInView = useInView(ref, { margin: '-5%', once: true })
|
|
|
|
return (
|
|
<LazyMotion features={domAnimation}>
|
|
<SectionContainer id={id} className={className}>
|
|
<div className="grid grid-cols-1 lg:grid-cols-12 gap-4 md:gap-8 xl:gap-10 justify-between">
|
|
<div className="col-span-full h-full lg:col-span-4">
|
|
<div
|
|
className={cn('gap-2 flex flex-col items-start', hasStickyTitle && 'sticky top-24')}
|
|
>
|
|
<h2 className="text-2xl sm:text-3xl xl:text-4xl max-w-[280px] sm:max-w-xs xl:max-w-[360px] tracking-[-1px]">
|
|
{title}
|
|
</h2>
|
|
<p className="text-lighter mb-4">{paragraph}</p>
|
|
{cta && (
|
|
<Button asChild size="small" icon={<ArrowUpRight />}>
|
|
<Link href={cta.link}>{cta.label ?? 'Explore documentation'}</Link>
|
|
</Button>
|
|
)}
|
|
</div>
|
|
</div>
|
|
{features && (
|
|
<div
|
|
ref={ref}
|
|
className="col-span-full lg:col-start-6 lg:col-span-7 space-y-10 lg:space-y-0 flex flex-col lg:grid lg:grid-cols-2 lg:gap-16"
|
|
>
|
|
{features.map((feature: Feature, i: number) => (
|
|
<Feature feature={feature} index={i} isInView={isInView} key={feature.title} />
|
|
))}
|
|
</div>
|
|
)}
|
|
</div>
|
|
</SectionContainer>
|
|
</LazyMotion>
|
|
)
|
|
}
|
|
|
|
const Feature = ({
|
|
feature,
|
|
index,
|
|
isInView,
|
|
}: {
|
|
feature: Feature
|
|
index: number
|
|
isInView: boolean
|
|
}) => {
|
|
const initial = INITIAL_BOTTOM
|
|
const animate = getAnimation({ delay: index * 0.1 })
|
|
|
|
return (
|
|
<m.div
|
|
className="h-full flex items-start space-x-3 w-full"
|
|
initial={initial}
|
|
animate={isInView ? animate : initial}
|
|
>
|
|
{feature.icon && (
|
|
<div className="flex items-center">
|
|
<div className="relative w-full h-6 flex items-center mx-auto">
|
|
<svg
|
|
width="25"
|
|
height="25"
|
|
viewBox="0 0 25 25"
|
|
fill="none"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
>
|
|
<path
|
|
d={feature.icon}
|
|
stroke="var(--foreground-default)"
|
|
strokeMiterlimit="10"
|
|
strokeLinejoin="round"
|
|
strokeLinecap="round"
|
|
strokeWidth="1.5"
|
|
/>
|
|
</svg>
|
|
</div>
|
|
</div>
|
|
)}
|
|
<div className="text-sm lg:text-base">
|
|
<h2 className="text-base">{feature.title}</h2>
|
|
<div className="prose pt-1 text-sm text-foreground-lighter">
|
|
<ReactMarkdown>{feature.text}</ReactMarkdown>
|
|
</div>
|
|
</div>
|
|
</m.div>
|
|
)
|
|
}
|
|
|
|
export default FeaturesSection
|