Files
supabase/apps/studio/components/interfaces/Support/SupportFormDirectEmailInfo.tsx
Gildas Garcia 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

53 lines
2.1 KiB
TypeScript

import { toast } from 'sonner'
import { NO_PROJECT_MARKER } from './SupportForm.utils'
import CopyButton from '@/components/ui/CopyButton'
interface SupportFormDirectEmailContentProps {
projectRef: string | null
}
export function SupportFormDirectEmailContent({ projectRef }: SupportFormDirectEmailContentProps) {
const hasProjectRef = projectRef && projectRef !== NO_PROJECT_MARKER
return (
<div className="text-sm text-foreground-light">
<p className="flex items-center gap-x-1.5 flex-wrap">
Please email us directly at
<span className="inline-flex items-center gap-x-1">
<a
href={`mailto:support@supabase.com?subject=${encodeURIComponent('Support Request')}${hasProjectRef ? `${encodeURIComponent(' for Project ID: ')}${encodeURIComponent(projectRef)}` : ''}&body=${encodeURIComponent('Here is a detailed description of the problem I am experiencing and any other information that might be helpful...')}`}
className="hover:text-foreground transition-colors duration-100"
>
<code className="text-code-inline !text-foreground-light underline decoration-foreground-lighter/50 hover:decoration-foreground-lighter/80 transition-colors duration-100">
support@supabase.com
</code>
</a>
<CopyButton
variant="text"
text="support@supabase.com"
iconOnly
onClick={() => toast.success('Copied email address to clipboard')}
/>
</span>{' '}
and include as much information as possible
{hasProjectRef && (
<>
, along with project ID
<span className="inline-flex items-center gap-x-1">
<code className="text-code-inline !text-foreground-light">{projectRef}</code>
<CopyButton
iconOnly
variant="text"
text={projectRef}
onClick={() => toast.success('Copied project ID to clipboard')}
/>
</span>
</>
)}
.
</p>
</div>
)
}