Skip to content

Commit

Permalink
feat(breadcrumb): add tooltipProps (#2990)
Browse files Browse the repository at this point in the history
* feat(breadcrumb): add tooltipprops

re #2989

* chore: update snapshot

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
carolin913 and github-actions[bot] committed Jul 11, 2024
1 parent 3c75ef6 commit 942264d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/breadcrumb/BreadcrumbItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const BreadcrumbItem = forwardRef<HTMLDivElement, BreadcrumbItemProps>((props, r
className,
content,
onClick,
tooltipProps,
...restProps
} = useDefaultProps<BreadcrumbItemProps>(props, breadcrumbItemDefaultProps);

Expand Down Expand Up @@ -95,7 +96,13 @@ const BreadcrumbItem = forwardRef<HTMLDivElement, BreadcrumbItemProps>((props, r

return (
<div className={classNames(breadcrumbItemClassNames, className)} ref={ref} onClick={handleClick} {...restProps}>
{isCutOff ? <TooltipLite content={children || content}>{itemContent}</TooltipLite> : itemContent}
{isCutOff ? (
<TooltipLite content={children || content} {...tooltipProps}>
{itemContent}
</TooltipLite>
) : (
itemContent
)}
<span className={separatorClassName}>{separatorContent}</span>
</div>
);
Expand Down
1 change: 1 addition & 0 deletions src/breadcrumb/breadcrumb.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ replace | Boolean | false | \- | N
router | Object | - | Typescript:`any` | N
target | String | _self | options: _blank/_self/_parent/_top | N
to | String / Object | - | Typescript:`string \| Route` `interface Route { path?: string; name?: string; hash?: string; query?: RouteData; params?: RouteData }` `type RouteData = { [key: string]: string \| string[] }`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/breadcrumb/type.ts) | N
tooltipProps | Object | - | Typescript:`TooltipProps`[Tooltip API Documents](./tooltip?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/breadcrumb/type.ts) | N
onClick | Function | | Typescript:`(e: MouseEvent) => void`<br/>trigger on click | N
1 change: 1 addition & 0 deletions src/breadcrumb/breadcrumb.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ replace | Boolean | false | 路由跳转是否采用覆盖的方式(覆盖后
router | Object | - | 路由对象。如果项目存在 Router,则默认使用 Router。TS 类型:`any` | N
target | String | _self | 链接或路由跳转方式。可选项:_blank/_self/_parent/_top | N
to | String / Object | - | 路由跳转目标,当且仅当 Router 存在时,该 API 有效。TS 类型:`string \| Route` `interface Route { path?: string; name?: string; hash?: string; query?: RouteData; params?: RouteData }` `type RouteData = { [key: string]: string \| string[] }`[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/breadcrumb/type.ts) | N
tooltipProps | Object | - | 透传提示组件属性。TS 类型:`TooltipProps`[Tooltip API Documents](./tooltip?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/breadcrumb/type.ts) | N
onClick | Function | | TS 类型:`(e: MouseEvent) => void`<br/>点击时触发 | N
5 changes: 5 additions & 0 deletions src/breadcrumb/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TooltipLiteProps as TooltipProps } from '../tooltip';
import { TNode, TElement } from '../common';
import { MouseEvent } from 'react';

Expand Down Expand Up @@ -66,6 +67,10 @@ export interface TdBreadcrumbItemProps {
* 路由跳转目标,当且仅当 Router 存在时,该 API 有效
*/
to?: string | Route;
/**
* 透传提示组件属性
*/
tooltipProps?: TooltipProps;
/**
* 点击时触发
*/
Expand Down

0 comments on commit 942264d

Please sign in to comment.