-
-
Notifications
You must be signed in to change notification settings - Fork 32.8k
[Tabs] Remove unnecessary wrapper from Tab
#26926
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1583,8 +1583,20 @@ You can use the [`collapse-rename-collapsedheight` codemod](https://github.com/m | |||||||||||||
| +<Tabs scrollButtons={false} /> | ||||||||||||||
| ``` | ||||||||||||||
|
|
||||||||||||||
| ### Tab | ||||||||||||||
|
|
||||||||||||||
| - Tab `minWidth` changed from `72px` => `90px` (without media-query) according to [material-design spec](https://material.io/components/tabs#specs) | ||||||||||||||
| - Tab `maxWidth` changed from `264px` => `360px` according to [material-design spec](https://material.io/components/tabs#specs) | ||||||||||||||
| - `span` element that wraps children has been removed. `wrapper` classKey is also removed. More details about [this change](https://github.com/mui-org/material-ui/pull/26666). | ||||||||||||||
|
||||||||||||||
| - Tab `minWidth` changed from `72px` => `90px` (without media-query) according to [material-design spec](https://material.io/components/tabs#specs) | |
| - Tab `maxWidth` changed from `264px` => `360px` according to [material-design spec](https://material.io/components/tabs#specs) | |
| - `span` element that wraps children has been removed. `wrapper` classKey is also removed. More details about [this change](https://github.com/mui-org/material-ui/pull/26666). | |
| - Change the Tab `minWidth` from `72px` => `90px` (without media-query) according to [material-design spec](https://material.io/components/tabs#specs) | |
| - Change the Tab `maxWidth` from `264px` => `360px` according to [material-design spec](https://material.io/components/tabs#specs) | |
| - Remove the `span` element that wraps children. Remove the `wrapper` classKey too. More details about [this change](https://github.com/mui-org/material-ui/pull/26666). |
cc @mbrookes for confirmation.
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.
I think it's confusing linking different PR here. Let's update the current PR description with the details of why the changes was introduced and link this PR in the migration guide.
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.
The passive voice doesn't feel right.
I'm not so sure. "Change the Tab minWidth" sounds like an instruction to the reader, whereas "Tab minWidth (was/has been) changed" describes what has changed:
- What changed
- What is/are the implication(s)
- What you need to do
(Situation, Complication, Resolution...)
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.
Intuitively I would've also preferred passive voice in changelogs.
Though it's not uncommon for changelogs to have active voice:
- https://github.com/facebook/react/blob/master/CHANGELOG.md
- https://keepachangelog.com/en/1.0.0/
changelogs with passive voice:
I could go on forever and find examples for active and passive voice. Though I can't find any resources on active vs passive voice for changelogs specifically (this is why "benchmarking" is generally useless to form an actionable advise).
I'd say it's more important to use a consistent voice throughout the document since I'm fine with either voice. Though definitely an interesting topic.
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.
Thanks for the two examples. Would it work if we use this framing?
- In the changelog, the PR's description are in the active voice because they describe the action of the change. It's more git focused. (what we have done so far)
- In the changelog's summary, the passive voice is used, because we focus on the developers not familiar with the codebase reading it. (what we have done so far)
- In the migration guide, the passive voice is used for the same reason as 3. (currently, a mix is used)
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.
similar thought as Sebastian, I am okay with the above proposal as long as we keep them consistent.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,7 +22,6 @@ const useUtilityClasses = (styleProps) => { | |
| selected && 'selected', | ||
| disabled && 'disabled', | ||
| ], | ||
| wrapper: ['wrapper'], | ||
| }; | ||
|
|
||
| return composeClasses(slots, getTabUtilityClass, classes); | ||
|
|
@@ -54,13 +53,15 @@ const TabRoot = styled(ButtonBase, { | |
| overflow: 'hidden', | ||
| whiteSpace: 'normal', | ||
| textAlign: 'center', | ||
| flexDirection: 'column', | ||
| lineHeight: 1.25, | ||
| /* Styles applied to the root element if both `icon` and `label` are provided. */ | ||
| ...(styleProps.icon && | ||
| styleProps.label && { | ||
| minHeight: 72, | ||
| paddingTop: 9, | ||
| paddingBottom: 9, | ||
| [`& .${tabClasses.wrapper} > *:first-child`]: { | ||
| [`& > *:first-child`]: { | ||
| marginBottom: 6, | ||
siriwatknp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| }), | ||
|
|
@@ -105,24 +106,9 @@ const TabRoot = styled(ButtonBase, { | |
| /* Styles applied to the root element if `wrapped={true}`. */ | ||
| ...(styleProps.wrapped && { | ||
| fontSize: theme.typography.pxToRem(12), | ||
| lineHeight: 1.5, | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this can be removed because |
||
| }), | ||
| })); | ||
|
|
||
| const TabWrapper = styled('span', { | ||
| name: 'MuiTab', | ||
| slot: 'Wrapper', | ||
| overridesResolver: (props, styles) => styles.wrapper, | ||
| })({ | ||
| /* Styles applied to the `icon` and `label`'s wrapper element. */ | ||
| display: 'inline-flex', | ||
| alignItems: 'center', | ||
| justifyContent: 'center', | ||
| width: '100%', | ||
| flexDirection: 'column', | ||
| lineHeight: 1.25, | ||
| }); | ||
|
|
||
| const Tab = React.forwardRef(function Tab(inProps, ref) { | ||
| const props = useThemeProps({ props: inProps, name: 'MuiTab' }); | ||
| const { | ||
|
|
@@ -197,10 +183,8 @@ const Tab = React.forwardRef(function Tab(inProps, ref) { | |
| tabIndex={selected ? 0 : -1} | ||
| {...other} | ||
| > | ||
| <TabWrapper className={classes.wrapper} styleProps={styleProps}> | ||
| {icon} | ||
| {label} | ||
| </TabWrapper> | ||
| {icon} | ||
| {label} | ||
| {indicator} | ||
| </TabRoot> | ||
| ); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.