mirror of
https://github.com/supabase/supabase.git
synced 2026-10-14 05:39:11 +03:00
22 lines
600 B
TypeScript
22 lines
600 B
TypeScript
import * as React from 'react'
|
|
import { ButtonHTMLAttributes, DetailedHTMLProps, PropsWithChildren, useRef } from 'react'
|
|
import { useCommandMenu } from './CommandMenuProvider'
|
|
|
|
const SearchButton = ({
|
|
children,
|
|
...props
|
|
}: PropsWithChildren<
|
|
DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>
|
|
>) => {
|
|
const searchButtonRef = useRef<HTMLButtonElement>()
|
|
const { setIsOpen } = useCommandMenu()
|
|
|
|
return (
|
|
<button type="button" ref={searchButtonRef} onClick={() => setIsOpen(true)} {...props}>
|
|
{children}
|
|
</button>
|
|
)
|
|
}
|
|
|
|
export default SearchButton
|