-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(dialog): dialog design fixes (#616)
* Typography * Take care of padding * Some design stuff * Final design fixes * Set height in case of removing buttons * Update the dialog's snapshot * Prettier and linting * Fix heading padding without icon * Fix content distance without heading * CR fixes * Fix depcheck * Update snapshot * remove unneeded selector * Add vvd-core Co-authored-by: Yuri Guller <gullerya@gmail.com>
- Loading branch information
1 parent
a489c8a
commit 96dadab
Showing
5 changed files
with
93 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,44 @@ | ||
@use '@vonage/vvd-design-tokens/build/scss/semantic-variables/scheme-variables' as scheme-variables; | ||
@use '@vonage/vvd-foundation/scss/variable-names/color-semantic-variable-names' as color-semantic; | ||
@use '@vonage/vvd-foundation/scss/mixins/color-connotation-mixins'; | ||
@use '@vonage/vvd-typography/scss/typography' as typography; | ||
|
||
:host { | ||
#title, #content, #actions, #dialog_icon { | ||
padding-right: 0; | ||
padding-left: 0; | ||
display: flex; | ||
} | ||
|
||
::slotted([slot=icon]) { | ||
margin-bottom: 18px; | ||
} | ||
|
||
#title { | ||
@include typography.typography-cat-shorthand('subtitle-2'); | ||
padding-bottom: 0; | ||
margin-bottom: 8px; | ||
} | ||
|
||
#content { | ||
@include typography.typography-cat-shorthand('body-2'); | ||
} | ||
|
||
#actions { | ||
@include typography.typography-cat-shorthand('body-2-bold'); | ||
padding-bottom: 0; | ||
} | ||
|
||
.mdc-dialog__surface { | ||
padding: 32px; | ||
} | ||
|
||
.mdc-dialog .mdc-dialog__content { | ||
padding-top: 0; | ||
} | ||
|
||
.mdc-dialog__content.last { | ||
padding-bottom: 0; | ||
} | ||
|
||
.mdc-dialog__title::before { | ||
height: 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,44 @@ | ||
import { customElement } from 'lit-element'; | ||
import { customElement, PropertyValues } from 'lit-element'; | ||
import { style } from './vwc-dialog.css'; | ||
import { Dialog as MWCDialog } from '@material/mwc-dialog'; | ||
import { style as mwcDialogStyle } from '@material/mwc-dialog/mwc-dialog-css'; | ||
import { style as styleCoupling } from '@vonage/vvd-style-coupling'; | ||
import '@vonage/vvd-core'; | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
'vwc-dialog': VWCDialog; | ||
} | ||
} | ||
|
||
const iconTemplate = document.createElement('template'); | ||
iconTemplate.innerHTML = ` | ||
<div id="dialog_icon"> | ||
<slot name="icon"></slot> | ||
</div> | ||
`; | ||
|
||
/* eslint-disable @typescript-eslint/ban-ts-comment */ | ||
// @ts-ignore | ||
MWCDialog.styles = [styleCoupling, mwcDialogStyle, style]; | ||
|
||
@customElement('vwc-dialog') | ||
export class VWCDialog extends MWCDialog { | ||
connectedCallback(): void { | ||
super.connectedCallback(); | ||
} | ||
protected updated(_changedProperties: PropertyValues): void { | ||
super.updated(_changedProperties); | ||
if (!this.renderRoot.querySelector('#dialog_icon')) { | ||
this.renderRoot | ||
.querySelector('.mdc-dialog__surface') | ||
?.prepend(iconTemplate.content.cloneNode(true)); | ||
} | ||
|
||
disconnectedCallback(): void { | ||
super.disconnectedCallback(); | ||
if (_changedProperties.has('hideActions')) { | ||
const contentElement = this.renderRoot.querySelector('#content'); | ||
if (contentElement) { | ||
_changedProperties.get('hideActions') | ||
? contentElement.classList.remove('last') | ||
: contentElement.classList.add('last'); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters