From 821421227cf4bab77e2753b05cf2b6c5c76c4aa7 Mon Sep 17 00:00:00 2001 From: Haider Alshamma Date: Tue, 10 Sep 2024 14:08:30 -0400 Subject: [PATCH] fix: code review fixes --- src/DropdownMenu/DropdownMenu.tsx | 6 +----- src/List/ListItem.tsx | 18 +++++++++++++----- src/Popper/Popper.tsx | 2 +- src/Tooltip/Tooltip.tsx | 4 ++-- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/DropdownMenu/DropdownMenu.tsx b/src/DropdownMenu/DropdownMenu.tsx index 3d173a55f..f2837b266 100644 --- a/src/DropdownMenu/DropdownMenu.tsx +++ b/src/DropdownMenu/DropdownMenu.tsx @@ -1,6 +1,5 @@ import React, { useMemo } from "react"; import propTypes from "@styled-system/prop-types"; -import { Reference } from "react-popper"; import { IconicButton } from "../Button"; import { ComponentSize, useComponentSize } from "../NDSProvider/ComponentSizeContext"; import { Popper } from "../Popper"; @@ -47,10 +46,7 @@ const transformPropsToModifiers = ({ boundariesElement }) => ({ boundariesElement, }); -const DropdownMenu: React.FC> = React.forwardRef< - Reference, - DropdownMenuProps ->( +const DropdownMenu = React.forwardRef, DropdownMenuProps>( ( { trigger = () => , diff --git a/src/List/ListItem.tsx b/src/List/ListItem.tsx index a45b1bacd..27b024552 100644 --- a/src/List/ListItem.tsx +++ b/src/List/ListItem.tsx @@ -1,12 +1,20 @@ +import React from "react"; import styled from "styled-components"; import { space, color, typography, SpaceProps, ColorProps, TypographyProps } from "styled-system"; type Props = React.ComponentPropsWithRef<"li"> & SpaceProps & ColorProps & TypographyProps; -const ListItem = styled.li(space, color, typography, { - "&:last-child": { - marginBottom: 0, - }, -}); +const ListItem = styled.li( + ({ theme }) => ({ + color: "currentcolor", + marginBottom: theme.space.x1, + "&:last-child": { + marginBottom: 0, + }, + }), + space, + color, + typography +); export default ListItem; diff --git a/src/Popper/Popper.tsx b/src/Popper/Popper.tsx index 8399c8d7d..d131c81dc 100644 --- a/src/Popper/Popper.tsx +++ b/src/Popper/Popper.tsx @@ -31,7 +31,7 @@ type PopperProps = { closeAriaLabel?: string; }; -const Popper = React.forwardRef( +const Popper = React.forwardRef, PopperProps>( ( { id, diff --git a/src/Tooltip/Tooltip.tsx b/src/Tooltip/Tooltip.tsx index c5062e3ed..1cc206789 100644 --- a/src/Tooltip/Tooltip.tsx +++ b/src/Tooltip/Tooltip.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { LegacyRef } from "react"; import { Popper } from "../Popper"; import { generateId } from "../utils"; import TooltipContainer from "./TooltipContainer"; @@ -26,7 +26,7 @@ export type TooltipProps = { children?: React.ReactNode; }; -const Tooltip = React.forwardRef( +const Tooltip = React.forwardRef, TooltipProps>( ( { showDelay = "100",