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

Add expand-headerless option to Panel component #1417

Merged
merged 7 commits into from
Dec 12, 2020

Conversation

raysonkoh
Copy link
Contributor

@raysonkoh raysonkoh commented Dec 12, 2020

What is the purpose of this pull request?

  • Documentation update
  • Bug fix
  • Feature addition or enhancement
  • Code maintenance
  • Others, please explain:

Fixes #925

Overview of changes:

  • Add a new option expand-headerless to the Panel component. If it is set as true, the Panel header will not be shown when the Panel is expanded, else the Panel header will be shown when the Panel is expanded. It is set as false by default.
  • Add test cases to test for expand-headerless behavior for both NestedPanel and MinimalPanel
  • Update User Guide --> Components --> Panels with explanation of expand-headerless

Anything you'd like to highlight / discuss:

  • Usage of v-if vs v-show: Tried to use v-show = "shouldShowHeader" but it seems to not be working. Only v-if = "shouldShowHeader" works. Would it be okay to use v-if in this case?

Testing instructions:
npm run test

Proposed commit message: (wrap lines at 72 characters) Add expand-headerless option to Panel component


Checklist: ☑️

  • Updated the documentation for feature additions and enhancements
  • Added tests for bug fixes or features
  • Linked all related issues
  • No blatantly unrelated changes
  • Pinged someone for a review!

Copy link
Contributor

@ang-zeyu ang-zeyu left a comment

Choose a reason for hiding this comment

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

Nice work on the tests!

Some nits:

docs/userGuide/syntax/panels.mbdf Outdated Show resolved Hide resolved
docs/userGuide/syntax/panels.mbdf Outdated Show resolved Hide resolved
@@ -3,7 +3,7 @@
<div v-show="localMinimized" class="morph">
<button class="morph-display-wrapper btn card-title morph-title" @click="open()">
<slot name="_alt">
<slot name="header"></slot>
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm, is this needed for minimal panels? (the header already automatically hides when expanded)

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 this is not needed, thanks!

@@ -80,12 +84,18 @@ export default {
hasHeaderBool() {
return this.$slots.header;
},
expandHeaderlessBool() {
return toBoolean(this.expandHeaderless);
Copy link
Contributor

Choose a reason for hiding this comment

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

the additional toBoolean shouldn't be required since you're using type: Boolean above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I will make the changes

@@ -3,7 +3,7 @@
<div v-show="localMinimized" class="morph">
<button :class="['morph-display-wrapper', 'btn', btnType, 'card-title']" @click="open()">
<slot name="_alt">
<slot name="header"></slot>
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm what's this for? seeing that we wouldn't have a panel expanded but minimized at the same time

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes this is not needed, thanks for the catch!

@@ -19,7 +19,7 @@
></span>
</div>
<div ref="headerWrapper" :class="['header-wrapper card-title', cardType, {'text-white':!isLightBg}]">
<slot name="header"></slot>
Copy link
Contributor

Choose a reason for hiding this comment

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

wondering if we should add some opacity transition of sorts to reduce the movement:

untitled

Copy link
Contributor

Choose a reason for hiding this comment

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

instead of removing it completely*

Copy link
Contributor Author

@raysonkoh raysonkoh Dec 12, 2020

Choose a reason for hiding this comment

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

I see so maybe like transition: 0.3s opacity for the header when it is expanded or something to that effect?

Copy link
Contributor Author

@raysonkoh raysonkoh Dec 12, 2020

Choose a reason for hiding this comment

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

Are you referring to this sort of behavior?

Dec-12-2020 19-59-27

Copy link
Contributor

Choose a reason for hiding this comment

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

yup - this looks great

so the height of the header shouldn't change before / after expansion, which may be jarring for the reader

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay thanks! I might need some more time to test this out, but I think I have addressed the rest of the PR comments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ang-zeyu You can check now to see whether the behavior is correct.

raysonkoh and others added 2 commits December 12, 2020 19:26
Co-authored-by: Ang Ze Yu <angzeyu@gmail.com>
- Remove v-if for minimized header since it is not needed
- Remove usage of toBoolean in expandHeaderlessBool
@@ -19,7 +19,7 @@
ref="headerWrapper"
:class="['card-title', 'card-title-transparent', { 'ellipses': !hasHeaderBool }]"
>
<span class="card-title-inline"><slot name="header"></slot></span>
<span class="card-title-inline"><slot v-if="shouldShowHeader" name="header"></slot></span>
Copy link
Contributor

Choose a reason for hiding this comment

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

missed one

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the catch!

@@ -80,12 +84,18 @@ export default {
hasHeaderBool() {
return this.$slots.header;
},
expandHeaderlessBool() {
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm do we still need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not needed anymore I will remove it, Thanks!

@@ -19,7 +19,7 @@
></span>
</div>
<div ref="headerWrapper" :class="['header-wrapper card-title', cardType, {'text-white':!isLightBg}]">
<slot name="header"></slot>
Copy link
Contributor

Choose a reason for hiding this comment

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

yup - this looks great

so the height of the header shouldn't change before / after expansion, which may be jarring for the reader

});
});

describe('MinimalPanel', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

let's remove the minimal panel ones since it dosen't have this feature

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay, removed!

- Remove all instances of shouldShowHeader in MinimalPanel
- Remove tests for expand-headerless for MinimalPanel
- Remove expandHeaderlessBool method in PanelBase
- Change opacity to 0 with transition if expand-headerless is true
Copy link
Contributor

@ang-zeyu ang-zeyu left a comment

Choose a reason for hiding this comment

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

Lgtm 👍

Thanks! @raysonkoh

@ang-zeyu ang-zeyu added this to the v3.0 milestone Dec 12, 2020
@ang-zeyu ang-zeyu merged commit afed1e1 into MarkBind:master Dec 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Panels: allow header-less panels
2 participants