mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES/NO ## What kind of change does this PR introduce? Bug fix, feature, docs update, ... ## What is the current behavior? Please link any relevant issues here. ## What is the new behavior? Feel free to include screenshots if it includes visual changes. ## Additional context Add any other context or screenshots. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Refreshed theming across the UI to use modern color expressions and shared theme variables (including OKLCH-based gradients), improving consistency for charts, code blocks, overlays, icons, and decorative backgrounds. * **Bug Fixes** * Improved light/dark color and gradient consistency across axis/grid styling, reference lines, buttons/badges, sidebar accents, loaders, and other visual components. * **Documentation** * Updated styling/theming guidance to align with the revised semantic token system and the updated theme variable usage patterns. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.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 { domAnimation, LazyMotion, m, useInView } from 'framer-motion'
|
|
import { ArrowUpRight } from 'lucide-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 variant="default" 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
|