Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
c7c878d
Change seamless property
jingting1412 Apr 4, 2024
e2f6301
Allocate space for scrollbar in nav components
jingting1412 Apr 5, 2024
2f17992
Merge branch 'MarkBind:master' into change-seamless
jingting1412 Apr 5, 2024
6ba4c0c
Change seamless panels
jingting1412 Apr 5, 2024
d895984
Merge branch 'MarkBind:master' into change-seamless
jingting1412 Apr 5, 2024
d3e94a0
Change <hr> to inherit colours
jingting1412 Apr 5, 2024
5c2d1c6
Fix unnecessary change
jingting1412 Apr 5, 2024
bb35d7b
Fix bug
jingting1412 Apr 5, 2024
c167f97
Improve look of seamless buttons
jingting1412 Apr 5, 2024
1ade57e
Merge branch 'master' into change-seamless
yucheng11122017 Apr 6, 2024
37cae18
Merge branch 'MarkBind:master' into change-seamless
jingting1412 Apr 7, 2024
e146ad1
Implement review changes
jingting1412 Apr 7, 2024
a721356
Merge branch 'master' into change-seamless
kaixin-hc Apr 7, 2024
53b71ff
Merge branch 'MarkBind:master' into change-seamless
jingting1412 Apr 9, 2024
4748e3f
Add tests
jingting1412 Apr 9, 2024
fb5fc71
Update userguide example
jingting1412 Apr 9, 2024
ff72dbd
Merge branch 'MarkBind:master' into change-seamless
jingting1412 Apr 12, 2024
9c0752d
Change morph-wrapper-seamless styles
jingting1412 Apr 12, 2024
578f815
Merge branch 'MarkBind:master' into change-seamless
jingting1412 Apr 12, 2024
057643e
Add shared styles for morph wrappers
jingting1412 Apr 12, 2024
bc09c01
Merge branch 'MarkBind:master' into change-seamless
jingting1412 Apr 16, 2024
f0d06b1
Change morph-display-wrapper-seamless
jingting1412 Apr 16, 2024
1f62ad3
Change morph-display-wrapper-seamless
jingting1412 Apr 16, 2024
b075167
Merge branch 'master' into change-seamless
yiwen101 Apr 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/userGuide/syntax/panels.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ plain text ...
</variable>
</include>

<box background-color="#C51E3A" color="white">

:bulb: Seamless panels inherit the background colour and text colour of any parents!
<br/>
<panel type="seamless" header="This is an example seamless panel">
This is its content.
</panel>
</box>

**Show/Hide buttons using `no-switch`, `no-close`, or `no-minimized-switch`.**

Expand Down
44 changes: 44 additions & 0 deletions packages/vue-components/src/__tests__/Panels.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
import { mount } from '@vue/test-utils';
import NestedPanel from '../panels/NestedPanel.vue';

const DEFAULT_STUBS = { 'nested-panel': NestedPanel };

const BOX_CONTAINER = `
<div style="color:white;">
<nested-panel type="seamless">
<template #header>Test Header</template>
<p>Test Content</p>
</nested-panel>
</div>
`;

describe('NestedPanels', () => {
test('should show header when collapsed with expandHeaderless as false', async () => {
const wrapper = mount(NestedPanel, {
Expand Down Expand Up @@ -72,4 +83,37 @@ describe('NestedPanels', () => {

expect(wrapper.element).toMatchSnapshot();
});

test('renders a seamless panel with a transparent background', async () => {
const wrapper = mount(NestedPanel, {
propsData: {
type: 'seamless',
},
slots: {
header: 'test header',
},
});

expect(wrapper.find('.card').classes()).toContain('card-seamless');
expect(wrapper.find('.card-header').classes()).toContain('bg-transparent');
expect(wrapper.element).toMatchSnapshot();
});

test('seamless panel should inherit parent background color', () => {
const ParentComponent = {
template: BOX_CONTAINER,
};

const wrapper = mount(ParentComponent, {
stubs: DEFAULT_STUBS,
});

const parentElement = wrapper.find('div');
const seamlessPanel = wrapper.findComponent(NestedPanel);

expect(seamlessPanel.props('type')).toBe('seamless');
expect(window.getComputedStyle(seamlessPanel.element).backgroundColor).toBe(
window.getComputedStyle(parentElement.element).backgroundColor,
);
});
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,84 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`NestedPanels renders a seamless panel with a transparent background 1`] = `
<div
class="card-container"
>
<div
class="card expandable-card card-seamless border-0"
>
<div
class="card-header header-toggle bg-transparent border-0"
>
<div
class="caret-wrapper"
>
<span
class="glyphicon glyphicon-chevron-right"
/>
</div>

<div
class="header-wrapper-seamless header-wrapper card-title bg-transparent"
>
test header
</div>

<div
class="button-wrapper"
>
<button
class="collapse-button btn btn-outline-light"
style="display: none;"
type="button"
>
<span
aria-hidden="true"
class="collapse-icon glyphicon glyphicon-menu-down"
/>
</button>

<button
class="close-button btn btn-outline-light seamless-button"
type="button"
>
<span
aria-hidden="true"
class="glyphicon glyphicon-remove"
/>
</button>

<button
class="popup-button btn btn-outline-light seamless-button"
style="display: none;"
type="button"
>
<span
aria-hidden="true"
class="glyphicon glyphicon-new-window"
/>
</button>
</div>
</div>

<div
class="card-collapse"
style="max-height: 0px;"
>
<!---->

<hr />
</div>

<transition-stub
name="peek-read-more-fade"
>
<!---->
</transition-stub>
</div>
</div>
`;

exports[`NestedPanels should have span.anchor when id is present 1`] = `
<div
class="card-container"
Expand Down
46 changes: 38 additions & 8 deletions packages/vue-components/src/panels/NestedPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
:class="['card-container', addClass]"
>
<span class="morph">
<button :class="['morph-display-wrapper', 'btn', btnType]" @click="open()">
<button
:class="['morph-display-wrapper',
{'morph-display-wrapper-seamless': isSeamless},
'btn',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't this button has the morph-display-wrapper anyway regardless of whether it is seamless or not?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I added the new morph-display-wrapper-seamless since I've noticed that the colour of the minimized panels would not inherit the parent's colour with just morph-display-wrapper

With just morph-display-wrapper:

Screen.Recording.2024-04-09.at.11.30.27.PM.mov

With morph-display-wrapper-seamless and morph-display-wrapper

Screen.Recording.2024-04-09.at.11.32.06.PM.mov

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As in does the a seamless button also need the properties from morph-display-wrapper?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No seamless buttons wouldn't need properties from morph-display-wrapper, seamless buttons only appear when the panel is not minimised so it shouldn't need any properties from morph-display-wrapper

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I've taken a video for your reference that shows that toggling these properties would make a visual difference. The caret button seems to also be a seamless button which appears when the panel is minimised, so the non seamless panels and the seamless panels then have slightly different styling due to this line of code.

Screen.Recording.2024-04-12.at.7.54.19.PM.mov

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rather than doing this or else statement, could all buttons have morph-display-wrapper by default and then only seamless buttons will have morph-display-wrapper-seamless?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yep sure I've implemented it as such now

btnType]"
@click="open()"
>
<div
v-if="!noMinimizedSwitch"
class="minimal-caret-wrapper"
Expand All @@ -27,7 +33,7 @@
ref="cardContainer"
:class="['card-container', addClass]"
>
<div :class="['card', { 'expandable-card': isExpandableCard }, borderType]">
<div :class="['card', { 'expandable-card': isExpandableCard, 'card-seamless': isSeamless }, borderType]">
<div
:class="['card-header',{'header-toggle':isExpandableCard}, cardType, borderType]"
@click.prevent.stop="isExpandableCard && toggle()"
Expand All @@ -40,8 +46,8 @@
</div>
<div
ref="headerWrapper"
:class="['header-wrapper card-title', cardType,
{'text-white':!isLightBg, 'header-transparent':!shouldShowHeader}]"
:class="[{'header-wrapper-seamless': isSeamless}, 'header-wrapper card-title', cardType,
{'text-white':!isLightBg && !isSeamless, 'header-transparent':!shouldShowHeader}]"
>
<slot name="header"></slot>
</div>
Expand Down Expand Up @@ -96,6 +102,7 @@
<panel-switch
v-show="isExpandableCard && bottomSwitchBool"
:is-open="localExpanded"
:is-seamless="isSeamless"
@click.native.stop.prevent="toggle(true)"
/>
</div>
Expand Down Expand Up @@ -133,8 +140,10 @@ export default {
return this.type === 'seamless';
},
btnType() {
if (this.isSeamless || this.type === 'light') {
if (this.type === 'light') {
return 'btn-outline-secondary';
} else if (this.isSeamless) {
return '';
}
return `btn-outline-${this.type || 'secondary'}`;
},
Expand All @@ -151,12 +160,12 @@ export default {
},
cardType() {
if (this.isSeamless) {
return 'bg-white';
return 'bg-transparent';
}
return `bg-${this.type || 'light'}`;
},
isLightBg() {
return this.cardType === 'bg-light' || this.cardType === 'bg-white' || this.cardType === 'bg-warning';
return this.cardType === 'bg-light' || this.cardType === 'bg-warning';
},
},
};
Expand All @@ -175,6 +184,13 @@ export default {
.seamless-button {
opacity: 0;
transition: 0.3s opacity;
color: inherit;
border-color: inherit;
}

.seamless-button:hover {
border-color: transparent;
background-color: color-mix(in srgb, currentcolor 25%, transparent);
}

.card-header:hover .seamless-button {
Expand Down Expand Up @@ -229,6 +245,10 @@ export default {
width: 100%;
}

.card-seamless {
background-color: inherit;
}

.card-title {
display: inline-block;
font-size: 1em;
Expand Down Expand Up @@ -279,6 +299,8 @@ export default {

.card-collapse > hr {
margin-top: 0;
background-color: currentcolor;
opacity: 0.5;
Comment thread
yucheng11122017 marked this conversation as resolved.
}

.card-group > .card-container > .expandable-card {
Expand All @@ -292,7 +314,7 @@ export default {

.bottom-button-wrapper > .collapse-button {
margin-top: 5px;
opacity: 0.2;
opacity: 0.5;
}

.bottom-button-wrapper > .collapse-button:hover {
Expand Down Expand Up @@ -324,6 +346,14 @@ export default {
align-items: center;
}

.morph-display-wrapper-seamless {
color: inherit;

@yucheng11122017 yucheng11122017 Apr 6, 2024

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is the difference between .morph-display-wrapper-seamless and .morph-display-wrapper only the inheritance of color?
In that case, could we make it such that .morph-display-wrapper-seamless is just color: inherit? So that if we decide to change like the margin-top or something, we only change it in one place
So the button will always have the class .morph-display-wrapper and will have the class .morph-display-wrapper-seamless if it is seamless

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yep sorry about that, I have made the changes accordingly

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've changed it now so that both the seamless and non-seamless morph wrapper would share the same basic styles, and only morph-display-wrapper-seamless will have the color:inherit property. This allows for future changes to the styles of all morph wrappers to be done in one place and allows the seamless wrapper to have the same styles as the other wrappers

}

.morph-display-wrapper-seamless:hover {
color: inherit;
}

/* Bootstrap extra small(xs) responsive breakpoint */
@media (width <= 575.98px) {
.header-wrapper {
Expand Down
18 changes: 17 additions & 1 deletion packages/vue-components/src/panels/PanelSwitch.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<template>
<button
type="button"
:class="['collapse-button', 'btn', isLightBg ? 'btn-outline-secondary' : 'btn-outline-light']"
:class="['collapse-button',
'btn',
isSeamless ? 'btn-seamless' : isLightBg ? 'btn-outline-secondary' : 'btn-outline-light']"
>
<span
:class="['collapse-icon', 'glyphicon', 'glyphicon-menu-down', {'opened': isOpenBool}]"
Expand All @@ -23,6 +25,10 @@ export default {
type: Boolean,
default: true,
},
isSeamless: {
type: Boolean,
default: false,
},
},
computed: {
isOpenBool() {
Expand All @@ -33,6 +39,16 @@ export default {
</script>

<style>
.btn-seamless {
color: inherit;
border-color: inherit;
}

.btn-seamless:hover {
color: inherit;
background-color: inherit;
}

.collapse-button {
font-size: 10px !important;
float: right;
Expand Down