mirror of
https://github.com/supabase/supabase.git
synced 2026-10-08 19:05:06 +03:00
## Problem Our `<Button>` component breaks the default `button` contract by redefining the `type` prop to set its variant (`primary`, `default`, etc) instead of the button type (`submit`, `button`, etc). This is confusing and forces to write more code when using it with shadcn components that expect/inject the standard button props. ## Solution - rename the `type` prop to `variant` - rename the `htmlType` prop to `type` - propagate the changes where necessary - format code ## How to test As this is just prop renaming, if it builds it's ok --------- Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
60 lines
1.7 KiB
TypeScript
60 lines
1.7 KiB
TypeScript
import SectionContainer from '~/components/Layouts/SectionContainer'
|
|
import { ArrowUpRight } from 'lucide-react'
|
|
import Link from 'next/link'
|
|
import { ReactNode } 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
|
|
}
|
|
content?: string
|
|
className?: string
|
|
hasStickyTitle?: boolean
|
|
}
|
|
|
|
const FeaturesSection = ({
|
|
id,
|
|
title,
|
|
content,
|
|
cta,
|
|
paragraph,
|
|
className,
|
|
hasStickyTitle,
|
|
}: Props) => (
|
|
<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 lg:col-span-4 gap-2 flex flex-col items-start">
|
|
<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 font-mono">{paragraph}</p>
|
|
{cta && (
|
|
<Button asChild variant="default" size="small" icon={<ArrowUpRight />}>
|
|
<Link href={cta.link}>{cta.label ?? 'Explore documentation'}</Link>
|
|
</Button>
|
|
)}
|
|
</div>
|
|
</div>
|
|
{content && (
|
|
<div className="col-span-full lg:col-start-6 lg:col-span-7 prose max-w-none! text-foreground-light">
|
|
<ReactMarkdown>{content}</ReactMarkdown>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</SectionContainer>
|
|
)
|
|
|
|
export default FeaturesSection
|