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

feat: add overflow trigger props #706

Merged
merged 8 commits into from
Apr 5, 2024

Conversation

CooperHash
Copy link
Contributor

@CooperHash CooperHash commented Mar 27, 2024

ref:ant-design/ant-design#44858
add a new props to control overflow trigger way

In the tabs component, currently we only have hover functionality for triggering the overflow. However, some scenarios require a click action.

Copy link

vercel bot commented Mar 27, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
tabs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 31, 2024 3:08pm

@@ -37,6 +38,7 @@ const OperationNode = React.forwardRef<HTMLDivElement, OperationNodeProps>((prop
locale,
mobile,
moreIcon = 'More',
moreTrigger = 'hover',
moreTransitionName,
Copy link
Member

@afc163 afc163 Mar 27, 2024

Choose a reason for hiding this comment

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

这些属性合并成:

more={{ ... }}

同时一并尝试解决 ant-design/ant-design#44858ant-design/ant-design#47507 的问题吧。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will Check it out later.

Copy link

codecov bot commented Mar 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.72%. Comparing base (afadb05) to head (25c8541).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #706   +/-   ##
=======================================
  Coverage   97.72%   97.72%           
=======================================
  Files          18       18           
  Lines         702      703    +1     
  Branches      192      200    +8     
=======================================
+ Hits          686      687    +1     
  Misses         16       16           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -18,8 +18,7 @@ export interface OperationNodeProps {
tabBarGutter?: number;
activeKey: string;
mobile: boolean;
moreIcon?: React.ReactNode;
moreTrigger?: moreTrigger;
more?: more
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
more?: more
more?: MoreProps;

src/interface.ts Outdated
Comment on lines 8 to 11
export type more = {
moreTrigger?: moreTrigger,
moreIcon?: moreIcon,
}
Copy link
Member

@afc163 afc163 Mar 27, 2024

Choose a reason for hiding this comment

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

Suggested change
export type more = {
moreTrigger?: moreTrigger,
moreIcon?: moreIcon,
}
export type MoreProps = {
icon?: moreIcon,
} & TriggerProps;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这里为什么用 & TriggerProps;这样的写法

Copy link
Member

Choose a reason for hiding this comment

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

为了支持 DropdownProps 所有能力。

@@ -36,7 +36,7 @@ const OperationNode = React.forwardRef<HTMLDivElement, OperationNodeProps>((prop
tabs,
locale,
mobile,
moreIcon = 'More',
more: moreProp = {},
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
more: moreProp = {},
more: moreProps = {},

@@ -52,6 +52,8 @@ const OperationNode = React.forwardRef<HTMLDivElement, OperationNodeProps>((prop
const [open, setOpen] = useState(false);
const [selectedKey, setSelectedKey] = useState<string>(null);

const { icon: moreIcon = 'More', trigger = 'hover' } = moreProp;
Copy link
Member

Choose a reason for hiding this comment

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

把 moreProps 放到 Dropdown 的属性最下面去,这个可以支持 DropdownProps 所有能力。

<Dropdown
  ...
  ...
  ...
  {...moreProps}
>

src/interface.ts Outdated
export type moreIcon = React.ReactNode;
export type MoreProps = {
icon?: moreIcon,
} & TriggerProps ;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
} & TriggerProps ;
} & DropdownProps ;

Copy link
Member

@afc163 afc163 Mar 28, 2024

Choose a reason for hiding this comment

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

别忘了从 rc-dropdown 里 import 出来。

@@ -36,7 +36,7 @@ const OperationNode = React.forwardRef<HTMLDivElement, OperationNodeProps>((prop
tabs,
locale,
mobile,
moreIcon = 'More',
more: moreProps = {},
moreTransitionName,
Copy link
Member

Choose a reason for hiding this comment

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

moreTransitionName 也可以干掉,改用 more={{ transitionName }} 支持。

src/interface.ts Outdated
@@ -10,6 +10,7 @@ export type TriggerProps = {
export type moreIcon = React.ReactNode;
export type MoreProps = {
icon?: moreIcon,
transitionName?: string,
Copy link
Member

Choose a reason for hiding this comment

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

DropdownProps 应该有 transitionName ?

@@ -18,8 +18,7 @@ export interface OperationNodeProps {
tabBarGutter?: number;
activeKey: string;
mobile: boolean;
moreIcon?: React.ReactNode;
moreTransitionName?: string;
more?: MoreProps
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
more?: MoreProps
more?: MoreProps;

@afc163
Copy link
Member

afc163 commented Mar 31, 2024

图片

Check that.

@CooperHash
Copy link
Contributor Author

图片

Check that.

prepare merge

@CooperHash
Copy link
Contributor Author

@afc163 check have passed

@afc163 afc163 merged commit 43e78d8 into react-component:master Apr 5, 2024
9 checks passed
@afc163
Copy link
Member

afc163 commented Apr 5, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants