Skip to content

Commit

Permalink
Fix dropdown popover wrapper changes
Browse files Browse the repository at this point in the history
  • Loading branch information
vineethasok committed Sep 29, 2023
1 parent 1fce0d1 commit 93dce21
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 17 deletions.
4 changes: 1 addition & 3 deletions src/components/Dropdown/Dropdown.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ const DropdownExample = ({ showArrow, disabled, side, ...props }: Props) => {
return (
<GridCenter>
<Dropdown {...props}>
<Dropdown.Trigger disabled={disabled}>
<div>Dropdown Trigger</div>
</Dropdown.Trigger>
<Dropdown.Trigger disabled={disabled}>Dropdown Trigger</Dropdown.Trigger>
<Dropdown.Content
showArrow={showArrow}
side={side}
Expand Down
4 changes: 1 addition & 3 deletions src/components/Dropdown/Dropdown.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ describe("Dropdown", () => {
const renderDropdown = ({ disabled, ...props }: Props) =>
renderCUI(
<Dropdown {...props}>
<Dropdown.Trigger disabled={disabled}>
<div>Dropdown Trigger</div>
</Dropdown.Trigger>
<Dropdown.Trigger disabled={disabled}>Dropdown Trigger</Dropdown.Trigger>
<Dropdown.Content>
<Dropdown.Group>
<Dropdown.Item>Content0</Dropdown.Item>
Expand Down
10 changes: 7 additions & 3 deletions src/components/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { HorizontalDirection, Icon, IconName } from "@/components";
import { Arrow, GenericMenuItem, GenericMenuPanel } from "../GenericMenu";
import PopoverArrow from "../icons/PopoverArrow";
import IconWrapper from "../IconWrapper/IconWrapper";
import { HTMLAttributes } from "react";
import { EmptyButton } from "../commonElement";

export const Dropdown = (props: DropdownMenu.DropdownMenuProps) => (
<DropdownMenu.Root {...props} />
Expand Down Expand Up @@ -62,9 +62,13 @@ const DropdownTrigger = ({
</DropdownMenuItem>
);
}
const { disabled, ...otherProps } = props as DropdownTriggerProps;
return (
<Trigger asChild>
<div {...(props as HTMLAttributes<HTMLDivElement>)} />
<Trigger
asChild
disabled={disabled}
>
<EmptyButton {...otherProps} />
</Trigger>
);
};
Expand Down
4 changes: 1 addition & 3 deletions src/components/Popover/Popover.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ const PopoverComponent = ({
open={open === "default" ? undefined : open === "open"}
modal={modal}
>
<Popover.Trigger>
<div>Click Here</div>
</Popover.Trigger>
<Popover.Trigger>Click Here</Popover.Trigger>
<Popover.Content
side={side}
showArrow={showArrow}
Expand Down
4 changes: 1 addition & 3 deletions src/components/Popover/Popover.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ describe("Popover", () => {
const renderPopover = (props: PopoverProps) =>
renderCUI(
<Popover {...props}>
<Popover.Trigger>
<div>Click Here</div>
</Popover.Trigger>
<Popover.Trigger>Click Here</Popover.Trigger>
<Popover.Content>
<div>
Click on the input element below
Expand Down
4 changes: 2 additions & 2 deletions src/components/Popover/Popover.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as RadixPopover from "@radix-ui/react-popover";
import { Arrow, GenericMenuPanel } from "../GenericMenu";
import styled from "styled-components";
import { HTMLAttributes, ReactNode } from "react";
import { ReactNode } from "react";
import { Icon } from "@/components";
import { EmptyButton } from "../commonElement";
import PopoverArrow from "../icons/PopoverArrow";
Expand All @@ -24,7 +24,7 @@ const PopoverTrigger = ({ anchor, ...props }: TriggerProps) => {
return (
<>
<Trigger asChild>
<div {...(props as HTMLAttributes<HTMLDivElement>)} />
<EmptyButton {...props} />
</Trigger>
{anchor && <RadixPopover.Anchor asChild>{anchor}</RadixPopover.Anchor>}
</>
Expand Down

0 comments on commit 93dce21

Please sign in to comment.