Skip to content

Commit

Permalink
Improve combobox for embedded apps
Browse files Browse the repository at this point in the history
  • Loading branch information
heisand committed Aug 14, 2023
1 parent d5679e2 commit 583031d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/spor-react/src/input/Combobox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export function Combobox<T extends object>({
<>
<Input
{...inputProps}
aria-haspopup="listbox"
ref={inputRef}
label={label}
borderBottomLeftRadius={
Expand Down
18 changes: 14 additions & 4 deletions packages/spor-react/src/input/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,28 @@ export const Popover = forwardRef<HTMLDivElement, PopoverProps>(
state
);

return (
<Overlay>
{hasBackdrop && <Box {...underlayProps} position="fixed" inset="0" />}
const PopOverBox = () => {
return (
<Box
{...popoverProps}
ref={popoverRef}
minWidth={triggerRef.current?.clientWidth ?? "auto"}
marginLeft={-2}
>
<DismissButton onDismiss={state.close} />
{!isNonModal && <DismissButton onDismiss={state.close} />}
{children}
<DismissButton onDismiss={state.close} />
</Box>
);
};

if (isNonModal) {
return <PopOverBox />;
}
return (
<Overlay>
{hasBackdrop && <Box {...underlayProps} position="fixed" inset="0" />}
<PopOverBox />
</Overlay>
);
}
Expand Down

0 comments on commit 583031d

Please sign in to comment.