Skip to content

Commit

Permalink
[v5] [core] feat: use CaretRight component in TreeNode (#6235)
Browse files Browse the repository at this point in the history
  • Loading branch information
adidahiya authored Jun 22, 2023
1 parent 41d5874 commit b3dd004
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/components/icon/icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { Classes, DISPLAYNAME_PREFIX, IntentProps, MaybeElement, Props, removeNo
// re-export for convenience, since some users won't be importing from or have a direct dependency on the icons package
export { IconName, IconSize };

export type IconHTMLAttributes = Omit<React.HTMLAttributes<HTMLElement>, "children" | "title">;
export type IconHTMLAttributes = Omit<React.HTMLAttributes<HTMLElement | SVGSVGElement>, "children" | "title">;

export interface IconProps extends IntentProps, Props, SVGIconProps, IconHTMLAttributes {
/**
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/components/tree/treeNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import classNames from "classnames";
import * as React from "react";

import { ChevronRight } from "@blueprintjs/icons";

import { Classes, DISPLAYNAME_PREFIX } from "../../common";
import { Collapse } from "../collapse/collapse";
import { Icon } from "../icon/icon";
Expand Down Expand Up @@ -100,13 +102,11 @@ export class TreeNode<T = {}> extends React.Component<TreeNodeProps<T>> {
Classes.TREE_NODE_CARET,
isExpanded ? Classes.TREE_NODE_CARET_OPEN : Classes.TREE_NODE_CARET_CLOSED,
);
const onClick = disabled === true ? undefined : this.handleCaretClick;
return (
<Icon
<ChevronRight
title={isExpanded ? "Collapse group" : "Expand group"}
className={caretClasses}
onClick={onClick}
icon={"chevron-right"}
onClick={disabled === true ? undefined : this.handleCaretClick}
/>
);
}
Expand Down
4 changes: 3 additions & 1 deletion packages/icons/src/svgIconProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ import * as React from "react";
* Interface used for generated icon components which already have their name and path defined
* (through the rendered Handlebars template).
*/
export interface SVGIconProps extends React.RefAttributes<any> {
export interface SVGIconProps
extends React.RefAttributes<any>,
Omit<React.DOMAttributes<HTMLElement | SVGSVGElement>, "children" | "dangerouslySetInnerHTML"> {
/** A space-delimited list of class names to pass along to the SVG element. */
className?: string;

Expand Down

1 comment on commit b3dd004

@adidahiya
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[v5] [core] feat: use CaretRight component in TreeNode (#6235)

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

Please sign in to comment.