Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Fix composed storybook TooltipLinkList bug where href isn't passed forward #29175

Merged
merged 4 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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