-
Notifications
You must be signed in to change notification settings - Fork 124
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
Conversation
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.
Nice work on the tests!
Some nits:
@@ -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> |
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.
hmm, is this needed for minimal panels? (the header already automatically hides when expanded)
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 this is not needed, thanks!
@@ -80,12 +84,18 @@ export default { | |||
hasHeaderBool() { | |||
return this.$slots.header; | |||
}, | |||
expandHeaderlessBool() { | |||
return toBoolean(this.expandHeaderless); |
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 additional toBoolean
shouldn't be required since you're using type: Boolean
above
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.
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> |
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.
hmm what's this for? seeing that we wouldn't have a panel expanded but minimized at the same time
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.
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> |
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.
instead of removing it completely*
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 see so maybe like transition: 0.3s opacity
for the header when it is expanded or something to that effect?
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.
yup - this looks great
so the height of the header shouldn't change before / after expansion, which may be jarring for the reader
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.
Okay thanks! I might need some more time to test this out, but I think I have addressed the rest of the PR comments.
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.
@ang-zeyu You can check now to see whether the behavior is correct.
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> |
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.
missed one
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 catch!
@@ -80,12 +84,18 @@ export default { | |||
hasHeaderBool() { | |||
return this.$slots.header; | |||
}, | |||
expandHeaderlessBool() { |
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.
hmm do we still need 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.
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> |
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 - this looks great
so the height of the header shouldn't change before / after expansion, which may be jarring for the reader
}); | ||
}); | ||
|
||
describe('MinimalPanel', () => { |
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.
let's remove the minimal panel ones since it dosen't have this feature
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.
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
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.
Lgtm 👍
Thanks! @raysonkoh
What is the purpose of this pull request?
Fixes #925
Overview of changes:
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.expand-headerless
behavior for bothNestedPanel
andMinimalPanel
expand-headerless
Anything you'd like to highlight / discuss:
v-if
vsv-show
: Tried to usev-show = "shouldShowHeader"
but it seems to not be working. Onlyv-if = "shouldShowHeader"
works. Would it be okay to usev-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: ☑️