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(vwc-side-drawer): remove absolute support #1029

Merged
merged 54 commits into from
Aug 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
20b9f05
feat(vwc-side-drawer): 1st draft
rinaok Jul 20, 2021
7d0d6fe
story added
rinaok Jul 25, 2021
4a0862c
story added
rinaok Jul 25, 2021
dabc12d
semi-transparent content model
yinonov Jul 25, 2021
a22dba3
alternate scheme
yinonov Jul 25, 2021
f19388c
alternate
rinaok Jul 25, 2021
4d165af
devider check
rinaok Jul 26, 2021
7f66692
working example
yinonov Jul 26, 2021
22d7599
this will break
yinonov Jul 26, 2021
e080a8c
this will not break
yinonov Jul 26, 2021
2a5ee28
slot="navigation"
rinaok Jul 26, 2021
e80c316
margin list
rinaok Jul 26, 2021
f0d12e1
side drawer bigger inline size
rinaok Jul 26, 2021
2d31f37
side drawer position
rinaok Jul 26, 2021
65cf376
appContent inlined
rinaok Jul 27, 2021
8c13aca
Merge branch 'master' into VIV-642/feature/vwc-side-drawer
tveinfeld Jul 28, 2021
cac389b
Merge branch 'master' into VIV-642/feature/vwc-side-drawer
tveinfeld Jul 28, 2021
cf6a3c6
documentation, header, image
rinaok Jul 28, 2021
e09a4c6
vvd-umbrella under devDependencies
rinaok Jul 29, 2021
3d3ac8f
@prop
rinaok Jul 29, 2021
7ff4b73
readme
rinaok Jul 29, 2021
73008d3
Update package.json
yinonov Jul 29, 2021
95f4109
Update package.json
yinonov Jul 29, 2021
0eb435f
Update package.json
yinonov Jul 29, 2021
fdc05ea
Update package.json
yinonov Jul 29, 2021
f09eb4e
Update package.json
yinonov Jul 29, 2021
51b3c8f
add border and shadow to side drawer
rinaok Jul 29, 2021
c7ed50d
activated
rinaok Jul 29, 2021
d9c5bfd
style
rinaok Jul 29, 2021
2d59c66
Extension panel should not be activated
rinaok Aug 1, 2021
913b230
wider side drawer
rinaok Aug 1, 2021
449102c
slots documentation
rinaok Aug 1, 2021
339ec8b
Merge branch 'master' into VIV-642/feature/vwc-side-drawer
yinonov Aug 2, 2021
f45ff02
restore yarn.lock
yinonov Aug 2, 2021
1c58e80
refer correct tokens
yinonov Aug 2, 2021
9cbb155
refactor
yinonov Aug 2, 2021
324d187
declartiveness
yinonov Aug 3, 2021
2e916ea
correct module import
yinonov Aug 3, 2021
e95a7f1
Merge branch 'master' of https://github.com/Vonage/vivid into VIV-642…
rinaok Aug 10, 2021
1d49563
Merge branch 'master' of https://github.com/Vonage/vivid into VIV-642…
rinaok Aug 16, 2021
b1a0d19
Merge branch 'master' of https://github.com/Vonage/vivid into VIV-642…
rinaok Aug 17, 2021
bbe0f12
ESlint
rinaok Aug 17, 2021
0b8e7ae
refactor names
rinaok Aug 17, 2021
12315e6
update readme
rinaok Aug 17, 2021
bded6a3
remove absolute
rinaok Aug 22, 2021
368c58e
Merge branch 'master' of https://github.com/Vonage/vivid into vwc-sid…
rinaok Aug 22, 2021
98bba63
split modal story
rinaok Aug 23, 2021
5290f2c
match svg to modal side drawer
rinaok Aug 23, 2021
efc5e1b
remove absolute from ui test
rinaok Aug 23, 2021
e769c0d
remove story duplications
rinaok Aug 23, 2021
b2317c3
yarn
rinaok Aug 24, 2021
c9ec634
add modal UI test
rinaok Aug 24, 2021
d0125f0
Merge branch 'master' into vwc-side-drawer-absolute
rinaok Aug 24, 2021
e50e634
Merge branch 'master' into vwc-side-drawer-absolute
yinonov Aug 25, 2021
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
1 change: 0 additions & 1 deletion components/side-drawer/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Represents a side drawer custom element.

| Property | Attribute | Type | Default |
|-------------|-------------|------------------------|---------|
| `absolute` | `absolute` | `boolean` | false |
| `alternate` | `alternate` | `boolean` | false |
| `hasTopBar` | `hasTopBar` | `boolean \| undefined` | |
| `open` | `open` | `boolean` | false |
Expand Down
23 changes: 5 additions & 18 deletions components/side-drawer/src/vwc-side-drawer-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,6 @@ export class VWCSideDrawerBase extends LitElement {
})
type = '';

/**
* @prop absolute - the modal and dismissible can be fixed or absolute
* accepts Boolean value
* @public
* */
@property({
type: Boolean,
reflect: true
})
absolute = true;

@property({
type: Boolean,
reflect: true
Expand Down Expand Up @@ -97,14 +86,12 @@ export class VWCSideDrawerBase extends LitElement {
const topBar = this.hasTopBar ? this.renderTopBar() : '';
const scrim = (this.type === 'modal' && this.open) ? this.renderScrim() : '';
const alternate = this.alternate ? 'vvd-scheme-alternate' : undefined;
const absolute = this.type === 'modal' && this.absolute;

const classes = {
'vvd-side-drawer--alternate': this.alternate,
'vvd-side-drawer--dismissible': dismissible,
'vvd-side-drawer--modal': modal,
'vvd-side-drawer--open': this.open,
'vvd-side-drawer--absolute': absolute,
};

const aside = html`<aside
Expand Down Expand Up @@ -143,11 +130,11 @@ export class VWCSideDrawerBase extends LitElement {

private renderScrim(): TemplateResult {
return html`
<div
class="vvd-side-drawer--scrim ${this.absolute ? 'vvd-side-drawer--absolute' : ''}"
@click="${this.#handleScrimClick}"
@keydown="${this.#handleScrimClick}"
></div>`;
<div
class="vvd-side-drawer--scrim"
@click="${this.#handleScrimClick}"
@keydown="${this.#handleScrimClick}"
></div>`;
}

#handleScrimClick(): void {
Expand Down
16 changes: 2 additions & 14 deletions components/side-drawer/src/vwc-side-drawer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,11 @@ $min-width: 280px;
}

.vvd-side-drawer--modal {
position: fixed;
top: 0;
right: initial;
bottom: 0;
left: 0;

&.vvd-side-drawer--absolute {
position: absolute;
}
&:not(.vvd-side-drawer--absolute) {
position: fixed;
}
}

.aside-container {
Expand All @@ -108,20 +102,14 @@ $min-width: 280px;

.vvd-side-drawer--scrim {
@include scrim-mixins.scrim-variables;
position: fixed;
z-index: calc(#{$z-index-default} - 1);
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: var(#{scrim-mixins.$vvd-scrim--background-color});
opacity: var(#{scrim-mixins.$vvd-scrim--opacity});

&.vvd-side-drawer--absolute {
position: absolute;
}
&:not(.vvd-side-drawer--absolute) {
position: fixed;
}
}


Expand Down
3 changes: 0 additions & 3 deletions components/side-drawer/stories/arg-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,4 @@ export const argTypes = {
hasTopBar: {
control: booleanControl
},
absolute: {
control: booleanControl
}
};
29 changes: 29 additions & 0 deletions components/side-drawer/stories/side-drawer-modal.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { html } from 'lit-element';
import { argTypes } from './arg-types.js';
import { unsafeSVG } from 'lit-html/directives/unsafe-svg';
import { pageContentMock } from '../../../scripts/storybook/svg_templates';
import { Basic } from './side-drawer.stories.js';

export default {
title: 'Alpha/Components/Side Drawer/Modal',
component: 'vwc-side-drawer',
argTypes
};

const Template = args => html`
<style>
div#demo {
top: 0px;
position: fixed;
display: flex;
width: 100%;
height: 100%;
}
</style>
<div id="demo">
${Basic(args)}
${unsafeSVG(pageContentMock('100%', '100%', 'xMinYMin slice'))}
</div>`;

export const Modal = Template.bind({});
Modal.args = { type: 'modal', open: true };
46 changes: 20 additions & 26 deletions components/side-drawer/stories/side-drawer.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ export default {
argTypes
};

let prevActivatedItem;

const titleStyles = {
color: "#C0C0C0",
fontWeight: "bold",
Expand All @@ -39,12 +37,17 @@ const Template = args => html`
height: 100%;
}
div#default > svg {
width: 100%;
height: 100%;
}
width: 100%;
height: 100%;
}
</style>

<div id="demo">
${Basic(args)}
<div id="default"></div>
${unsafeSVG(pageContentMock())}
</div>`;

const SideDrawerTemplate = args => html`
<vwc-side-drawer id="side-drawer" ...=${spread(args)} @click="${onClick}">
<span slot="top-bar">
<vwc-icon type="vonage-mono"></vwc-icon> VONAGE
Expand Down Expand Up @@ -88,15 +91,21 @@ const Template = args => html`
<vwc-list-item shape="rounded">2nd level item</vwc-list-item>
</vwc-list-expansion-panel>
</vwc-list>
</vwc-side-drawer>`;

</vwc-side-drawer>
export const Basic = SideDrawerTemplate.bind({});
Basic.args = { };

<div id="default"></div>
${unsafeSVG(pageContentMock())}
export const Alternate = Template.bind({});
Alternate.args = { alternate: true };

</div>
`;
export const TopBar = Template.bind({});
TopBar.args = { hasTopBar: true };

export const Dismissible = Template.bind({});
Dismissible.args = { type: 'dismissible', open: true };

let prevActivatedItem;
function onClick(e) {
// only list items can be activated
if (e.target.localName !== "vwc-list-item") {
Expand All @@ -111,18 +120,3 @@ function onClick(e) {
prevActivatedItem = e.target;
prevActivatedItem.activated = true;
}

export const Basic = Template.bind({});
Basic.args = { };

export const Alternate = Template.bind({});
Alternate.args = { alternate: true };

export const TopBar = Template.bind({});
TopBar.args = { hasTopBar: true };

export const Dismissible = Template.bind({});
Dismissible.args = { type: 'dismissible', open: true };

export const Modal = Template.bind({});
Modal.args = { type: 'modal', open: true };
5 changes: 1 addition & 4 deletions components/side-drawer/test/side-drawer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,12 @@ describe('Side-drawer', () => {
expect(actualElement.hasTopBar, 'hasTopBar should be undefined')
.to
.equal(undefined);
expect(actualElement.absolute, 'absolute should be false')
.to
.equal(true);
});
});

describe('Side drawer attributes', () => {
it('should reflect from attribute to property', async () => {
const COMPONENT_PROPERTIES = ['open', 'alternate', 'hasTopBar', 'absolute'];
const COMPONENT_PROPERTIES = ['open', 'alternate', 'hasTopBar'];
for await (const property of COMPONENT_PROPERTIES) {
const [actualElement] = addElement(
textToDomToParent(`<${COMPONENT_NAME} ${property}></${COMPONENT_NAME}>`)
Expand Down
4 changes: 2 additions & 2 deletions scripts/storybook/svg_templates.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
pageContentMock: function (width = 782, height = 754) {
pageContentMock: function (width = '782', height = '754', preserveAspectRatio = 'xMidYMin') {
return `
<svg width='${width}' height='${height}' viewBox='0 0 ${width} ${height}' preserveAspectRatio='xMidYMin' fill='none' xmlns='http://www.w3.org/2000/svg'>
<svg width=${width} height=${height} viewBox='0 0 782 754' preserveAspectRatio='${preserveAspectRatio}' fill='none' xmlns='http://www.w3.org/2000/svg'>
\t<style>
\t\t.scheme_1 {
\t\t\tfill: var(--vvd-color-neutral-10, #eee);
Expand Down
Binary file added ui-tests/snapshots/vwc-side-drawer-modal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ui-tests/snapshots/vwc-side-drawer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
70 changes: 70 additions & 0 deletions ui-tests/tests/vwc-side-drawer-modal/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import '@vonage/vwc-side-drawer';
import '@vonage/vwc-list/vwc-list-expansion-panel.js';
import '@vonage/vwc-list/vwc-list.js';
import '@vonage/vwc-list/vwc-list-item.js';
import '@vonage/vwc-icon/vwc-icon.js';
import { snapshotTheWholePage } from '../../utils/testPageUtils';
import { pageContentMock } from '../../../scripts/storybook/svg_templates';

export async function createElementVariations(wrapper) {
snapshotTheWholePage(wrapper);
const elementWrapper = document.createElement('div');
elementWrapper.innerHTML = `
<style>
div#demo {
top: 0px;
position: fixed;
display: flex;
width: 100%;
height: 100%;
}
</style>

<div>
<div id="demo">
<vwc-side-drawer id="side-drawer" type="modal" hasTopBar open>
<span slot="top-bar">
<vwc-icon type="vonage-mono"></vwc-icon> VONAGE
</span>

<vwc-list
innerRole="navigation"
innerAriaLabel="Primary navigation"
itemRoles="link"
>
<vwc-list-item shape="rounded" graphic="icon">
<vwc-icon slot="graphic" type="home-line"></vwc-icon>1st level item
</vwc-list-item>

<p>SECTION TITLE</p>

<vwc-list-item shape="rounded" graphic="icon">
<vwc-icon slot="graphic" type="chat-line"></vwc-icon>1st level item
</vwc-list-item>

<vwc-list-expansion-panel open>
<vwc-list-item slot="header" shape="rounded" graphic="icon">
<vwc-icon slot="graphic" type="chat-line"></vwc-icon>1st level item
</vwc-list-item>
<vwc-list-expansion-panel open>
<vwc-list-item slot="header" shape="rounded"
>2nd level item</vwc-list-item
>
<vwc-list-item shape="rounded">3rd level item</vwc-list-item>
<vwc-list-item shape="rounded">3rd level item</vwc-list-item>
</vwc-list-expansion-panel>
</vwc-list-expansion-panel>
</vwc-list>

</vwc-side-drawer>

<div id="default"></div>
${pageContentMock('100%', '100%', 'xMinYMin slice')}

</div>
</div>
`;
wrapper.appendChild(elementWrapper);
}


Loading