♻️ refactor: use dialog overlay instead of div

This commit is contained in:
Wahyu Kurniawan 2024-03-06 13:09:23 +07:00
parent b75957929a
commit 90295fd620
No known key found for this signature in database
GPG Key ID: 040A1549143A8E33

View File

@ -26,13 +26,8 @@ export const ProjectSearchBarDialog = ({
const client = useGQLClient(); const client = useGQLClient();
const navigate = useNavigate(); const navigate = useNavigate();
const { const { getInputProps, getItemProps, inputValue, setInputValue } =
getMenuProps, useCombobox({
getInputProps,
getItemProps,
inputValue,
setInputValue,
} = useCombobox({
items, items,
itemToString(item) { itemToString(item) {
return item ? item.name : ''; return item ? item.name : '';
@ -74,9 +69,10 @@ export const ProjectSearchBarDialog = ({
return ( return (
<Dialog.Root {...props}> <Dialog.Root {...props}>
<Dialog.Portal> <Dialog.Portal>
<div className="bg-base-bg fixed inset-0 md:hidden overflow-y-auto"> <Dialog.Overlay className="bg-base-bg fixed inset-0 md:hidden overflow-y-auto" />
<Dialog.Content> <Dialog.Content>
<div className="py-2.5 px-4 w-full flex items-center justify-between border-b border-border-separator/[0.06]"> <div className="h-full flex flex-col fixed top-0 inset-0">
<div className="py-2.5 px-4 flex items-center justify-between border-b border-border-separator/[0.06]">
<Input <Input
{...getInputProps()} {...getInputProps()}
leftIcon={<SearchIcon />} leftIcon={<SearchIcon />}
@ -89,7 +85,7 @@ export const ProjectSearchBarDialog = ({
</Button> </Button>
</div> </div>
{/* Content */} {/* Content */}
<div {...getMenuProps()} className="flex flex-col gap-1 px-2 py-2"> <div className="flex flex-col gap-1 px-2 py-2">
{items.length > 0 {items.length > 0
? items.map((item, index) => ( ? items.map((item, index) => (
<> <>
@ -107,8 +103,8 @@ export const ProjectSearchBarDialog = ({
)) ))
: inputValue && <ProjectSearchBarEmpty />} : inputValue && <ProjectSearchBarEmpty />}
</div> </div>
</Dialog.Content>
</div> </div>
</Dialog.Content>
</Dialog.Portal> </Dialog.Portal>
</Dialog.Root> </Dialog.Root>
); );