Skip to content

Commit

Permalink
Merge pull request #29175 from JSMike/patch-1
Browse files Browse the repository at this point in the history
Fix composed storybook TooltipLinkList bug where href isn't passed forward

(cherry picked from commit 1a50094)
  • Loading branch information
kasperpeulen authored and storybook-bot committed Sep 24, 2024
1 parent 89a3f32 commit ade0f73
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion code/core/src/components/components/tooltip/ListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ const getItemProps = memoize(100)((onClick, href, LinkWrapper) => ({

export type LinkWrapperType = (props: any) => ReactNode;

export interface ListItemProps extends Omit<ComponentProps<typeof Item>, 'href' | 'title'> {
export interface ListItemProps extends Omit<ComponentProps<typeof Item>, 'title'> {
loading?: boolean;
title?: ReactNode;
center?: ReactNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface Link extends Omit<ListItemProps, 'onClick'> {
id: string;
onClick?: (
event: SyntheticEvent,
item: Pick<ListItemProps, 'id' | 'active' | 'disabled' | 'title'>
item: Pick<ListItemProps, 'id' | 'active' | 'disabled' | 'title' | 'href'>
) => void;
}

Expand All @@ -31,11 +31,11 @@ interface ItemProps extends Link {
}

const Item = ({ id, onClick, ...rest }: ItemProps) => {
const { active, disabled, title } = rest;
const { active, disabled, title, href } = rest;

const handleClick = useCallback(
(event: SyntheticEvent) => onClick?.(event, { id, active, disabled, title }),
[onClick, id, active, disabled, title]
(event: SyntheticEvent) => onClick?.(event, { id, active, disabled, title, href }),
[onClick, id, active, disabled, title, href]
);

return <ListItem id={`list-item-${id}`} {...rest} {...(onClick && { onClick: handleClick })} />;
Expand Down

0 comments on commit ade0f73

Please sign in to comment.