-
-
Notifications
You must be signed in to change notification settings - Fork 53.5k
feat: ConfigProvider support Collapse semantic props classNames
and styles
#52258
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
Conversation
|
👁 Visual Regression Report for PR #52258 Failed ❌
Important There are 1 diffs found in this PR: 🔄
|
WalkthroughThis pull request introduces a new feature to the Changes
|
@@ -136,7 +142,21 @@ const Collapse = React.forwardRef<HTMLDivElement, CollapseProps>((props, ref) => | |||
expandIcon={renderExpandIcon} | |||
prefixCls={prefixCls} | |||
className={collapseClassName} | |||
style={{ ...collapse?.style, ...style }} | |||
style={{ ...collapse?.styles?.root, ...collapse?.style, ...styles?.root, ...style }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure that the merging of styles does not unintentionally override important styles. Consider the order of merging to maintain intended styling priorities.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## next #52258 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 760 760
Lines 13681 13681
Branches 3576 3576
=========================================
Hits 13681 13681 ☔ View full report in Codecov by Sentry. |
More templates
commit: |
Bundle ReportChanges will increase total bundle size by 3.15kB (0.09%) ⬆️. This is within the configured threshold ✅ Detailed changes
|
faa4de9
to
691f24e
Compare
691f24e
to
af29d0d
Compare
components/collapse/Collapse.tsx
Outdated
if (children) { | ||
return toArray(children).map((child) => child); | ||
return toArray(children).map((child) => | ||
React.cloneElement(child as React.ReactElement<ItemType>, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里有问题,如果是通过 items
传递的是没有这些信息的。而且这么写感觉有点臃肿,可以考虑加个 context 来传递 classNames 和 styles
}, | ||
]; | ||
|
||
return ( | ||
<div style={{ position: 'absolute', inset: 0 }}> | ||
<div style={{ position: 'absolute', inset: 0, margin: '42px 24px 50px' }}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useToken
里取 token.marginXXL
?这样如果是紧凑主题也会跟着变的。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { useToken } from '../../theme/internal';
const [, token] = useToken();
return (
<div style={{ position: 'absolute', inset: 0, margin: token.marginXL }}>
中文版模板 / Chinese template
🤔 This is a ...
🔗 Related Issues
wait for react-component/collapse#358
📝 Change Log
classNames
andstyles
.classNames
和styles
。