mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 18:05:11 +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>
78 lines
2.3 KiB
TypeScript
78 lines
2.3 KiB
TypeScript
import { Github } from 'lucide-react'
|
|
import Link from 'next/link'
|
|
import { Button } from 'ui'
|
|
|
|
import { BranchSelector } from './BranchSelector'
|
|
import { DocsButton } from '@/components/ui/DocsButton'
|
|
import type { Branch } from '@/data/branches/branches-query'
|
|
import { DOCS_URL } from '@/lib/constants'
|
|
|
|
const EMPTY_STATE_CONTAINER = 'flex items-center flex-col gap-0.5 justify-center w-full py-10 px-4'
|
|
|
|
export const PullRequestsEmptyState = ({
|
|
url,
|
|
projectRef,
|
|
branches,
|
|
onBranchSelected,
|
|
isUpdating,
|
|
hasGithubConnection,
|
|
}: {
|
|
url: string
|
|
projectRef: string
|
|
branches: Branch[]
|
|
onBranchSelected: (branch: Branch) => void
|
|
isUpdating: boolean
|
|
hasGithubConnection?: boolean
|
|
}) => {
|
|
return (
|
|
<div className={EMPTY_STATE_CONTAINER}>
|
|
<p>No merge requests</p>
|
|
<p className="text-foreground-lighter text-center text-balance">
|
|
Create your first merge request to merge changes back to the main branch
|
|
</p>
|
|
<div className="flex items-center space-x-2 mt-4">
|
|
{hasGithubConnection ? (
|
|
<Button variant="outline" asChild icon={<Github />}>
|
|
<a href={url} target="_blank" rel="noopener noreferrer">
|
|
Create pull request
|
|
</a>
|
|
</Button>
|
|
) : (
|
|
<Button asChild variant="outline">
|
|
<Link href={`/project/${projectRef}/settings/integrations`}>Connect to GitHub</Link>
|
|
</Button>
|
|
)}
|
|
<BranchSelector
|
|
variant="outline"
|
|
align="center"
|
|
branches={branches}
|
|
onBranchSelected={onBranchSelected}
|
|
isUpdating={isUpdating}
|
|
/>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export const PreviewBranchesEmptyState = ({
|
|
onSelectCreateBranch,
|
|
}: {
|
|
onSelectCreateBranch: () => void
|
|
}) => {
|
|
return (
|
|
<div className={EMPTY_STATE_CONTAINER}>
|
|
<p>Create your first preview branch</p>
|
|
<p className="text-foreground-lighter text-center text-balance mb-4">
|
|
Preview branches are short-lived environments that let you safely experiment with changes to
|
|
your database schema without affecting your main database.
|
|
</p>
|
|
<div className="flex items-center space-x-2">
|
|
<DocsButton href={`${DOCS_URL}/guides/platform/branching`} />
|
|
<Button variant="primary" onClick={() => onSelectCreateBranch()}>
|
|
Create branch
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|