mirror of
https://github.com/supabase/supabase.git
synced 2026-06-29 11:57:37 -04:00
96d43099bb
## 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>
28 lines
942 B
TypeScript
28 lines
942 B
TypeScript
import { X } from 'lucide-react'
|
|
import { Button } from 'ui'
|
|
|
|
import { useBucketFilePickerStateSnapshot } from './BucketFilePickerState'
|
|
|
|
export const BucketFilePickerHeaderSelection = () => {
|
|
const { selectedItems, clearSelectedItems } = useBucketFilePickerStateSnapshot()
|
|
|
|
return (
|
|
<div className="z-10 flex h-[40px] items-center rounded-t-md bg-brand-400 px-2 py-1 shadow in-data-[theme*=dark]:bg-brand-500">
|
|
<Button
|
|
icon={<X size={16} strokeWidth={2} />}
|
|
variant="text"
|
|
onClick={() => clearSelectedItems()}
|
|
aria-label="Clear selected items"
|
|
/>
|
|
<div className="ml-1 flex items-center space-x-3">
|
|
<p className="mb-0 text-sm text-foreground">
|
|
<span style={{ fontVariantNumeric: 'tabular-nums' }}>{selectedItems.length}</span> items
|
|
selected
|
|
</p>
|
|
|
|
<div className="border-r border-green-900 py-3 opacity-50" />
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|