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(collapsible-panel): add prop to set alignment of header controls #1101

Merged
merged 4 commits into from
Oct 16, 2019

Conversation

jonnybel
Copy link
Contributor

@jonnybel jonnybel commented Oct 15, 2019

Summary

This PR proposes adding a prop to set the alignment of the headerControls of CollapsiblePanel.

Why?

We have a bunch of these CollapsiblePanel components in our MC which have a input/control on the left side of header. Currently, our component allows setting a headerControls but it’s always aligned to the right and there is no way to override that positioning.
image

This example in the image is achieved by setting the input in the header prop, and we need to add a wrapper to make sure clicking on the input/control doesn’t trigger the collapsing of the panel. This seems unnecessary because the headerControls prop already does this for you, but we can’t use it because of the inflexible alignment.

To-do

If this accepted, I'll add the VRTs and update the readme. ☑️

@jonnybel jonnybel added 💅 Type: Enhancement Improves existing code 👨‍🎨 Status: UI/UX Review Requires review from design team 🚧 Status: WIP Work in progress labels Oct 15, 2019
const baseStyles = css`
display: flex;
flex: 1;
align-items: center;
list-style-type: none;
justify-content: space-between;
justify-content: ${headerControlsAlignment === '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 like the fact that alignment encapsulates the fact that flexbox is used instead of exposing all justify-content options through the prop.

@jonnybel jonnybel self-assigned this Oct 15, 2019
@montezume
Copy link
Contributor

Looks reasonable to me

@montezume
Copy link
Contributor

Kind of annoying we can't really rely on our VRTs because of the new prop

#875

@jonnybel jonnybel removed 👨‍🎨 Status: UI/UX Review Requires review from design team 🚧 Status: WIP Work in progress labels Oct 16, 2019
@jonnybel jonnybel merged commit 07ad46d into master Oct 16, 2019
@jonnybel jonnybel deleted the ja-feat-panel-add-align-controls branch October 16, 2019 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💅 Type: Enhancement Improves existing code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants