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>
58 lines
1.7 KiB
TypeScript
58 lines
1.7 KiB
TypeScript
import { TextSearch } from 'lucide-react'
|
|
import { Button } from 'ui'
|
|
|
|
import type { AdvisorTab } from '@/state/advisor-state'
|
|
|
|
interface EmptyAdvisorProps {
|
|
activeTab: AdvisorTab
|
|
hasFilters: boolean
|
|
onClearFilters: () => void
|
|
}
|
|
|
|
export const EmptyAdvisor = ({ activeTab, hasFilters, onClearFilters }: EmptyAdvisorProps) => {
|
|
const getHeading = () => {
|
|
if (hasFilters) return 'No items found'
|
|
|
|
switch (activeTab) {
|
|
case 'security':
|
|
return 'No security issues detected'
|
|
case 'performance':
|
|
return 'No performance issues detected'
|
|
case 'messages':
|
|
return 'No messages'
|
|
default:
|
|
return 'No issues detected'
|
|
}
|
|
}
|
|
|
|
const getMessage = () => {
|
|
if (hasFilters) return 'No advisor items match your current filters'
|
|
|
|
switch (activeTab) {
|
|
case 'security':
|
|
return 'Congrats! There are no security issues detected for this project'
|
|
case 'performance':
|
|
return 'Congrats! There are no performance issues detected for this project'
|
|
case 'messages':
|
|
return 'Messages alert you of upcoming changes or potential issues with your project'
|
|
default:
|
|
return 'Congrats! There are no issues detected'
|
|
}
|
|
}
|
|
|
|
return (
|
|
<div className="h-full px-6 flex flex-col items-center justify-center w-full gap-y-2">
|
|
<TextSearch className="text-foreground-muted" strokeWidth={1} />
|
|
<div className="flex flex-col items-center gap-y-0.5 text-center">
|
|
<h3 className="heading-default">{getHeading()}</h3>
|
|
<p className="text-foreground-light text-sm text-balance">{getMessage()}</p>
|
|
</div>
|
|
{hasFilters && (
|
|
<Button variant="outline" onClick={onClearFilters}>
|
|
Clear filters
|
|
</Button>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|