mirror of
https://github.com/supabase/supabase.git
synced 2026-10-09 19:35: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>
66 lines
1.7 KiB
TypeScript
66 lines
1.7 KiB
TypeScript
import Link from 'next/link'
|
|
import React from 'react'
|
|
import { Button, cn } from 'ui'
|
|
|
|
import SectionContainer from '@/components/Layouts/SectionContainer'
|
|
|
|
export interface CtaSectionProps {
|
|
id: string
|
|
title: string | React.ReactNode
|
|
subtitle?: string
|
|
primaryCta: {
|
|
label: string
|
|
url: string
|
|
target?: string
|
|
icon?: React.ReactNode
|
|
}
|
|
secondaryCta?: {
|
|
label: string
|
|
url: string
|
|
}
|
|
image?: {
|
|
dark: string
|
|
light: string
|
|
}
|
|
className?: string
|
|
}
|
|
|
|
const CtaSection = ({
|
|
id,
|
|
title,
|
|
subtitle,
|
|
primaryCta,
|
|
secondaryCta,
|
|
className,
|
|
}: CtaSectionProps) => {
|
|
return (
|
|
<SectionContainer
|
|
id={id}
|
|
className={cn('py-16 md:py-24 lg:py-32 relative overflow-hidden', className)}
|
|
>
|
|
<div className="mx-auto relative z-10">
|
|
<div className="flex flex-col gap-6 text-center items-center max-w-5xl mx-auto">
|
|
<h2 className="text-foreground-light text-2xl lg:text-3xl leading-tight">{title}</h2>
|
|
{subtitle && <p className="text-foreground-light text-lg">{subtitle}</p>}
|
|
<div className="flex flex-wrap gap-3 pt-4">
|
|
<Button asChild size="medium" icon={primaryCta.icon}>
|
|
<Link href={primaryCta.url} target={primaryCta.target}>
|
|
{primaryCta.label}
|
|
</Link>
|
|
</Button>
|
|
{secondaryCta && (
|
|
<Button asChild size="medium" variant="default">
|
|
<Link href={secondaryCta.url}>{secondaryCta.label}</Link>
|
|
</Button>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div className="absolute inset-0 w-full h-full bg-linear-to-r from-transparent via-transparent to-background opacity-80 z-0"></div>
|
|
</SectionContainer>
|
|
)
|
|
}
|
|
|
|
export default CtaSection
|