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>
51 lines
1.5 KiB
TypeScript
51 lines
1.5 KiB
TypeScript
import { SupportCategories } from '@supabase/shared-types/out/constants'
|
|
import { useParams } from 'common'
|
|
import { Button } from 'ui'
|
|
import { Admonition } from 'ui-patterns/admonition'
|
|
|
|
import { SupportLink } from '../Support/SupportLink'
|
|
import type { ResponseError } from '@/types'
|
|
|
|
export interface StorageBucketsErrorProps {
|
|
error: ResponseError
|
|
}
|
|
|
|
const StorageBucketsError = ({ error }: StorageBucketsErrorProps) => {
|
|
const { ref } = useParams()
|
|
|
|
return (
|
|
<div className="storage-container flex items-center justify-center grow">
|
|
<div>
|
|
<Admonition
|
|
type="warning"
|
|
layout="horizontal"
|
|
title="Failed to fetch buckets"
|
|
description={
|
|
<>
|
|
<p className="mb-1">
|
|
Please try refreshing your browser, or contact support if the issue persists
|
|
</p>
|
|
<p>Error: {(error as any)?.message ?? 'Unknown'}</p>
|
|
</>
|
|
}
|
|
actions={
|
|
<Button key="contact-support" asChild variant="default" className="ml-4">
|
|
<SupportLink
|
|
queryParams={{
|
|
projectRef: ref,
|
|
category: SupportCategories.DASHBOARD_BUG,
|
|
subject: 'Unable to fetch storage buckets',
|
|
}}
|
|
>
|
|
Contact support
|
|
</SupportLink>
|
|
</Button>
|
|
}
|
|
/>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default StorageBucketsError
|