Skip to content

Commit

Permalink
refactor: fjern default verdier
Browse files Browse the repository at this point in the history
  • Loading branch information
kristianulv23 committed Sep 10, 2024
1 parent 3de467d commit 79e2499
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions packages/popover-react/src/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ const usePopover = ({
const context = data.context;

const role = useRole(context, {
enabled: true,
role: "dialog",
...roleOptions,
});

Expand Down Expand Up @@ -236,16 +234,17 @@ interface PopoverContentProps {

const PopoverContent = React.forwardRef<HTMLDivElement, React.HTMLProps<HTMLDivElement> & PopoverContentProps>(
function PopoverContent({ style, className, padding, ...props }, propRef) {
const { context: floatingContext, floatingFocusManagerOptions, ...context } = usePopoverContext();
const ref = useMergeRefs([context.refs.setFloating, propRef]);
const { context, floatingFocusManagerOptions, refs, open, floatingStyles, getFloatingProps } =
usePopoverContext();
const ref = useMergeRefs([refs.setFloating, propRef]);

const { theme, density } = getThemeAndDensity(context.refs.reference.current as HTMLElement);
const { theme, density } = getThemeAndDensity(refs.reference.current as HTMLElement);

if (!floatingContext.open) return null;
if (!open) return null;

return (
<FloatingPortal>
<FloatingFocusManager context={floatingContext} {...floatingFocusManagerOptions}>
<FloatingFocusManager context={context} {...floatingFocusManagerOptions}>
<div
data-theme={theme}
data-layout-density={density}
Expand All @@ -254,11 +253,11 @@ const PopoverContent = React.forwardRef<HTMLDivElement, React.HTMLProps<HTMLDivE
style={
{
...style,
...context.floatingStyles,
...floatingStyles,
"--popover-padding": `var(--jkl-spacing-${padding})`,
} as React.CSSProperties
}
{...context.getFloatingProps(props)}
{...getFloatingProps(props)}
>
{props.children}
</div>
Expand Down

0 comments on commit 79e2499

Please sign in to comment.