Files
supabase/apps/studio/components/ui/NoSearchResults.tsx
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

42 lines
1.0 KiB
TypeScript

import { Button, cn } from 'ui'
export interface NoSearchResultsProps {
searchString?: string
withinTableCell?: boolean
onResetFilter?: () => void
className?: string
label?: string
description?: string
}
export const NoSearchResults = ({
searchString,
withinTableCell = false,
onResetFilter,
className,
label,
description,
}: NoSearchResultsProps) => {
return (
<div
className={cn(
'flex items-center justify-between',
!withinTableCell && 'bg-surface-100 px-4 md:px-6 py-4 rounded-md border border-default',
className
)}
>
<div className="text-sm flex flex-col gap-y-0.5">
<p className="text-foreground">{label ?? 'No results found'}</p>
<p className="text-foreground-lighter">
{description ?? `Your search for “${searchString}” did not return any results`}
</p>
</div>
{onResetFilter !== undefined && (
<Button variant="default" onClick={() => onResetFilter()}>
Reset filter
</Button>
)}
</div>
)
}