-
Notifications
You must be signed in to change notification settings - Fork 26
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(CollapsiblePanel): add hideExpansionControls
(not hidden by default)
#421
Conversation
hideExpansionControls
and do not hide controls when disabledhideExpansionControls
and do not hide controls when disabled
hideExpansionControls
and do not hide controls when disabledhideExpansionControls
(not hidden by default)
})} | ||
className={classnames( | ||
this.props.className, | ||
styles[`container-theme-${this.props.theme}`], |
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.
A similar classname was built up by convention elsewhere in the file. Doing the same here shortens the classnames
"block".
<div className={styles['truncate-header']}> | ||
<Spacings.Inline alignItems="center" scale="s"> | ||
{!this.props.isDisabled && ( | ||
{!this.props.hideExpansionControls && ( |
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 actual change. Instead of hiding them when disabled we show them.
@tdeekens can you ask @mariabarrena to review the percy diff? |
Yup was about to. |
| `description` | `String` | | - | | If passed will be shown below the title as more information regarding the panel | | ||
| `isDisabled` | `bool` | | - | false | Disables the panel and all interactions with it | | ||
| `children` | `node` | | - | - | The actual content rendered inside the panel | | ||
| `hideExpansionControls` | `bool` | | - | - | Controls the visibility of the expansion controls on the left | |
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'm not sure about this prop name. @dferber90 any ideas?
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.
It's an attempt to align it with some inputs which also have an option to be expanded. The intend was to have transferable vocabulary also across components of different groups. Let me know if you come up with a better name and the reasoning for it.
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.
but we no longer have any other props called hideExpansionControls
, they were changed here.
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.
They're called hideCurrencyExpansionControls
or hideLanguageExpansionControls
. I presume you want it more specific? hidePanelExpansionControls
maybe? Your call, gimme a name :)
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.
Well in this case you are expanding or collapsing... maybe the name is correct after all 🤷♂️
Just a note this is just in case the component is disabled right? So we could assume that you set it whenever is disabled meaning that the panel is collapsed so now you can only expand 🤔
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 don't really have strong opinions on it. hideExpansionControls is fine by me. 🤷♂️
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 will wait for the @dferber90 to give his feedback for this.
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'm fine with this name 👍
We used more specific names (defaultExpandMultilineText
, defaultExpandLanguages
) in LocalizedMultilineTextInput
as there are two things which can be expanded/collapsed. Here it's only one thing, so hideExpansionControls
seems fine. On a sidenote, LocalizedMultilineTextInput
only accepts hideLanguageExpansionControls
as the multiline expansion controls can't be hidden (yet).
LocalizedMultilineTextInput
always acts as an uncontrolled component regarding its expansion states (it doesn't accept the state from the parent). Therefore it doesn't accept props like expandMultilineText
or expandLanguages
(or isMultilineTextExpanded
and areLanguagesExpanded
).
For the component in this PR, I slightly dislike that hideExpansionControls
and isClosed
don't use the same terminology (open/closed vs expanded/collapsed). We could do hideExpansionControls
and isExpanded
so that they use the same terminology for the same concept which shows that the props belong together. But that's probably not worth the refactoring as we'd also need to flip the default. So let's just keep isClosed
and add hideExpansionControls
.
It looks exactly how it was designed. Thanks! |
@mariabarrena sure, it makes sense to visually test all the possible iterations 👍 . |
Sure, I'll add them. I just tried to keep it a bit more minimal. I'll add all variations coming to mind. |
Alright @mariabarrena I added more visual specs. Adding all is close to bit silly as it's quite a bit of combinations. I added at least one per case and "combination variation". So condensed is disabled and urgent too yadada. |
| `description` | `String` | | - | | If passed will be shown below the title as more information regarding the panel | | ||
| `isDisabled` | `bool` | | - | false | Disables the panel and all interactions with it | | ||
| `children` | `node` | | - | - | The actual content rendered inside the panel | | ||
| `hideExpansionControls` | `bool` | | - | - | Controls the visibility of the expansion controls on the left | |
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.
Well in this case you are expanding or collapsing... maybe the name is correct after all 🤷♂️
Just a note this is just in case the component is disabled right? So we could assume that you set it whenever is disabled meaning that the panel is collapsed so now you can only expand 🤔
| `hideExpansionControls` | `bool` | | - | - | Controls the visibility of the expansion controls on the left | | ||
| `headerControls` | `node` | | - | - | Controls at the top right part of the panel | | ||
| `tone` | `oneOf` | | ['urgent', 'primary'] | 'primary' | - | | ||
| `className` | `bool` | | - | - | - | |
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.
Note in the scope of this PR obviously but this should go away so no custom CSS leaks into the component 😋
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.
Yup. That would be a breaking change however.
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.
Yeah, it would be more appropriate to create an issue for that.
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.
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!
@mariabarrena can you approve the percy diff so we can get this merged then? 😇 |
"Condensed light", "Condensed light - hideExpansionControls" and "Condensed light is Disabled" are showing the dark theme and not the light one. Once that is fixed, we are good to go. I'll wait for the change to approve it. |
f9eafde
to
02be63b
Compare
Summary
This pull request adds an
hideExpansionControls
to the<CollapiblePanel />
while (by default) showing the expansion controls in disabled visuals when the panel itself is disabled.Description
The images visualises the change. The change itself is reasoned in not having the content in the header of the panel "shift" or move when disabling or enabling it. So a previously clickable part remains clickable and does not move away underneath a user's mouse.