From 90e90f5e3a03d9aacdca018eca27d2dc3f808480 Mon Sep 17 00:00:00 2001 From: Kevin Ghadyani Date: Fri, 2 Jun 2023 14:25:42 -0500 Subject: [PATCH 1/3] fix: not showing Button's tooltipText when the prop is passed --- packages/odyssey-react-mui/src/Button.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/odyssey-react-mui/src/Button.tsx b/packages/odyssey-react-mui/src/Button.tsx index 18d876bc65..42b4518c47 100644 --- a/packages/odyssey-react-mui/src/Button.tsx +++ b/packages/odyssey-react-mui/src/Button.tsx @@ -12,7 +12,7 @@ import { Button as MuiButton } from "@mui/material"; import type { ButtonProps as MuiButtonProps } from "@mui/material"; -import { memo, ReactElement, useContext, useMemo } from "react"; +import { memo, ReactElement, useCallback, useContext } from "react"; import { Icon } from "./Icon"; import { MuiPropsContext } from "./MuiPropsContext"; @@ -48,8 +48,8 @@ const Button = ({ }: ButtonProps) => { const muiProps = useContext(MuiPropsContext); - const button = useMemo( - () => ( + const renderButton = useCallback( + (muiProps) => ( {tooltipText && ( - {button} + {renderButton} )} - {!tooltipText && button} + + {!tooltipText && renderButton(muiProps)} ); }; From 79a6332e3b87230a25e1a198a939fbe515a600c6 Mon Sep 17 00:00:00 2001 From: Kevin Ghadyani Date: Mon, 5 Jun 2023 15:16:03 -0500 Subject: [PATCH 2/3] fix: minor ordering of properties in Tooltip stories --- .../odyssey-mui/Tooltip/Tooltip.stories.tsx | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/packages/odyssey-storybook/src/components/odyssey-mui/Tooltip/Tooltip.stories.tsx b/packages/odyssey-storybook/src/components/odyssey-mui/Tooltip/Tooltip.stories.tsx index 370fceeead..1f3af02825 100644 --- a/packages/odyssey-storybook/src/components/odyssey-mui/Tooltip/Tooltip.stories.tsx +++ b/packages/odyssey-storybook/src/components/odyssey-mui/Tooltip/Tooltip.stories.tsx @@ -47,8 +47,8 @@ const storybookMeta: Meta = { }, }, placement: { - options: ["top", "right", "bottom", "left"], control: { type: "radio" }, + options: ["bottom", "left", "right", "top"], }, }, args: { @@ -109,18 +109,10 @@ export const Placement: StoryObj = { render: function C() { return ( <> - -