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(CollapsiblePanel): add hideExpansionControls (not hidden by default) #421

Merged
merged 6 commits into from
Jan 10, 2019

Conversation

tdeekens
Copy link
Contributor

@tdeekens tdeekens commented Jan 10, 2019

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.

cleanshot 2019-01-10 at 10 06 44

@tdeekens tdeekens changed the title Add hideExpansionControls and do not hide controls when disabled [CollapsiblePanel]: Add hideExpansionControls and do not hide controls when disabled Jan 10, 2019
@tdeekens tdeekens changed the title [CollapsiblePanel]: Add hideExpansionControls and do not hide controls when disabled feat(CollapsiblePanel): add hideExpansionControls (not hidden by default) Jan 10, 2019
})}
className={classnames(
this.props.className,
styles[`container-theme-${this.props.theme}`],
Copy link
Contributor Author

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 && (
Copy link
Contributor Author

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.

@montezume
Copy link
Contributor

@tdeekens can you ask @mariabarrena to review the percy diff?

@tdeekens
Copy link
Contributor Author

@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 |
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

@tdeekens tdeekens Jan 10, 2019

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 :)

Copy link
Contributor

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 🤔

Copy link
Contributor

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. 🤷‍♂️

Copy link
Contributor Author

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.

Copy link
Contributor

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).

Sidenote

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.

@mariabarrena
Copy link
Contributor

It looks exactly how it was designed. Thanks!
Before approve it on percy, I want to double check with any of you one thing. In the screenshot I see some of the possible states of the panel being showed on light and dark themes (f.e. "urgent and dark" and "urgent and light") However for disabled I just see one theme being showed. We definitely need the disabled and the hide expansion control states for both themes. Do we need to show both on percy?

@montezume
Copy link
Contributor

@mariabarrena sure, it makes sense to visually test all the possible iterations 👍 .

@tdeekens
Copy link
Contributor Author

tdeekens commented Jan 10, 2019

Do we need to show both on percy?

Sure, I'll add them. I just tried to keep it a bit more minimal. I'll add all variations coming to mind.

@tdeekens
Copy link
Contributor Author

tdeekens commented Jan 10, 2019

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.

Ref to Percy

| `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 |
Copy link
Contributor

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` | | - | - | - |
Copy link
Contributor

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 😋

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor

@qmateub qmateub left a comment

Choose a reason for hiding this comment

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

:shipit:

Copy link
Contributor

@dferber90 dferber90 left a comment

Choose a reason for hiding this comment

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

Thanks!

@montezume montezume added the 👨‍🎨 Status: UI/UX Review Requires review from design team label Jan 10, 2019
@montezume
Copy link
Contributor

@mariabarrena can you approve the percy diff so we can get this merged then? 😇

@mariabarrena
Copy link
Contributor

"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.

@tdeekens tdeekens force-pushed the feat/auto-close-collapsible-when-disabled branch from f9eafde to 02be63b Compare January 10, 2019 12:40
@tdeekens tdeekens merged commit 0bd7fa9 into master Jan 10, 2019
@tdeekens tdeekens deleted the feat/auto-close-collapsible-when-disabled branch January 10, 2019 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👨‍🎨 Status: UI/UX Review Requires review from design team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants