Files
Gildas GarciaandIvan Vasilov 96d43099bb chore: refactor Button API so that it can be used a standard button (#46880)
## 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>
2026-06-16 23:59:58 +02:00

39 lines
1.2 KiB
TypeScript

import { ExternalLink } from 'lucide-react'
import { Button } from 'ui'
import {
ScaffoldContainer,
ScaffoldSection,
ScaffoldSectionContent,
ScaffoldSectionDetail,
} from '@/components/layouts/Scaffold'
import { CustomContentTypes } from '@/hooks/custom-content/CustomContent.types'
interface CustomDocumentProps {
doc: CustomContentTypes['organizationLegalDocuments'][number]
}
export const CustomDocument = ({ doc }: CustomDocumentProps) => {
return (
<ScaffoldContainer id={doc.id}>
<ScaffoldSection className="py-12">
<ScaffoldSectionDetail>
<p className="text-base m-0">{doc.name}</p>
<div className="space-y-2 text-sm text-foreground-light [&_p]:m-0">
<p>{doc.description}</p>
</div>
</ScaffoldSectionDetail>
<ScaffoldSectionContent>
<div className="@lg:flex items-center justify-center h-full">
<Button asChild variant="default" iconRight={<ExternalLink />}>
<a download href={doc.action.url} target="_blank" rel="noreferrer noopener">
{doc.action.text}
</a>
</Button>
</div>
</ScaffoldSectionContent>
</ScaffoldSection>
</ScaffoldContainer>
)
}