Skip to content

Commit

Permalink
chore(@clayui/core): fixes typescript errors
Browse files Browse the repository at this point in the history
matuzalemsteles committed Dec 6, 2024
1 parent 3c43c64 commit bba9e6b
Showing 3 changed files with 27 additions and 5 deletions.
10 changes: 7 additions & 3 deletions packages/clay-core/src/nav/Link.tsx
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ export interface IProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
}

export const Link = React.forwardRef<
HTMLButtonElement | HTMLAnchorElement,
HTMLButtonElement | HTMLAnchorElement | HTMLDivElement,
IProps
>(
(
@@ -55,14 +55,18 @@ export const Link = React.forwardRef<
if (showIcon) {
return (
<div
{...otherProps}
{...(otherProps as Omit<
IProps,
keyof React.AnchorHTMLAttributes<HTMLAnchorElement>
> &
React.HTMLAttributes<HTMLDivElement>)}
className={classNames('nav-link', className, {
active,
['collapse-icon']: showIcon,
collapsed,
disabled,
})}
ref={ref}
ref={ref as React.Ref<HTMLDivElement>}
>
{children}
<span className="collapse-icon-closed">
2 changes: 1 addition & 1 deletion packages/clay-core/src/vertical-nav/Item.tsx
Original file line number Diff line number Diff line change
@@ -81,7 +81,7 @@ const ParentContext = React.createContext<React.RefObject<
HTMLButtonElement | HTMLAnchorElement
> | null>(null);

export function Item<T extends object>({
export function Item<T extends Record<string, any>>({
active: depreactedActive,
children,
href,
20 changes: 19 additions & 1 deletion packages/clay-core/stories/VerticalNav.stories.tsx
Original file line number Diff line number Diff line change
@@ -490,6 +490,24 @@ export const ControlledExpandedKeys = () => {
);
};

type ProductMenuItem = {
id: string;
href?: string;
label: string;
active?: boolean;
icon?: string;
itemClass?: string;
sticker?: {
displayType: string;
label: string;
};
plusButton?: {
ariaLabel: string;
title: string;
};
items?: Array<ProductMenuItem>;
};

const items_cms_product_menu = [
{
href: '#home',
@@ -591,7 +609,7 @@ const items_cms_product_menu = [
itemClass: 'mt-3',
label: 'Recycle Bin',
},
] as Array<Item>;
] as Array<ProductMenuItem>;

export const Primary = () => {
return (

0 comments on commit bba9e6b

Please sign in to comment.