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

HTML, Lumo and Material update #13

Merged
merged 6 commits into from
Feb 5, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
24 changes: 15 additions & 9 deletions src/vaadin-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,23 @@ class MessageElement extends ElementMixin(ThemableMixin(PolymerElement)) {
display: none !important;
}

.vaadin-message-wrapper {
[part='content'] {
display: flex;
flex-direction: column;
flex: 1;
flex-grow: 1;
Peppe marked this conversation as resolved.
Show resolved Hide resolved
}

.vaadin-message-header {
[part='header'] {
align-items: baseline;
display: flex;
flex-direction: row;
flex-wrap: wrap;
}

[part='name'] {
flex: 1;
}

[part='time'] {
Peppe marked this conversation as resolved.
Show resolved Hide resolved
}
</style>
<vaadin-avatar
Expand All @@ -98,12 +102,12 @@ class MessageElement extends ElementMixin(ThemableMixin(PolymerElement)) {
tabindex="-1"
aria-hidden="true"
></vaadin-avatar>
<div class="vaadin-message-wrapper">
<div class="vaadin-message-header">
<div part="name">[[user.name]]</div>
<div part="time">[[time]]</div>
<div part="content">
<div part="header">
<span part="name">[[user.name]]</span>
<span part="time">[[time]]</span>
</div>
<div part="content">
<div part="message">
<slot></slot>
</div>
</div>
Expand All @@ -112,6 +116,8 @@ class MessageElement extends ElementMixin(ThemableMixin(PolymerElement)) {

ready() {
super.ready();
this.setAttribute('aria-live', 'polite');
this.setAttribute('role', 'listitem');
}

static get is() {
Expand Down
2 changes: 1 addition & 1 deletion test/visual/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

<script type="module">
(async () => {
const theme = window.location.search.replace(/.*theme=(\w+).*/, '$1') || 'lumo';
const theme = window.location.search.replace(/.*theme=(\w+).*/, '$1') || 'material';
Peppe marked this conversation as resolved.
Show resolved Hide resolved

await import('../../theme/' + theme + '/vaadin-message.js');

Expand Down
28 changes: 12 additions & 16 deletions theme/lumo/vaadin-message-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,36 @@ import '@vaadin/vaadin-lumo-styles/color.js';
import '@vaadin/vaadin-lumo-styles/sizing.js';
import '@vaadin/vaadin-lumo-styles/spacing.js';
import '@vaadin/vaadin-lumo-styles/style.js';
import '@vaadin/vaadin-lumo-styles/typography.js';
import '@vaadin/vaadin-avatar/theme/lumo/vaadin-avatar.js';

registerStyles(
'vaadin-message',
css`
:host {
padding: var(--lumo-space-s);
}

:host {
color: var(--lumo-body-text-color);
font-family: var(--lumo-font-family);
font-size: var(--lumo-font-size-m);
line-height: var(--lumo-line-height-m);
padding: var(--lumo-space-s) var(--lumo-space-m);
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
-webkit-text-size-adjust: 100%;
}

.vaadin-message-wrapper {
padding-left: var(--lumo-space-s);
padding-right: 0;
}

:host([dir='rtl']) .vaadin-message-wrapper {
padding-left: 0;
padding-right: var(--lumo-space-s);
}

.vaadin-message-header {
padding-bottom: var(--lumo-space-s);
vaadin-avatar {
margin-inline-end: var(--lumo-space-s);
Peppe marked this conversation as resolved.
Show resolved Hide resolved
margin-top: calc(var(--lumo-space-xs) * 1.5);
}

[part='name'] {
font-weight: 500;
margin-inline-end: var(--lumo-space-s);
Peppe marked this conversation as resolved.
Show resolved Hide resolved
}

[part='time'] {
color: var(--lumo-secondary-text-color);
font-size: var(--lumo-font-size-s);
}
`,
{ moduleId: 'lumo-message' }
Expand Down
35 changes: 17 additions & 18 deletions theme/material/vaadin-message-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,34 @@ import '@vaadin/vaadin-avatar/theme/lumo/vaadin-avatar.js';
registerStyles(
'vaadin-message',
css`
:host {
padding: 8px;
}

:host {
font-family: var(--material-font-family);
font-size: var(--material-small-font-size);
}

.vaadin-message-wrapper {
padding-left: 8px;
padding-right: 0;
font-size: var(--material-body-font-size);
line-height: 1.5;
padding: 0.875em 1em;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
-webkit-text-size-adjust: 100%;
}

:host([dir='rtl']) .vaadin-message-wrapper {
padding-left: 0;
padding-right: 8px;
}

.vaadin-message-header {
padding-bottom: 8px;
vaadin-avatar {
margin-inline-end: 0.5em;
Peppe marked this conversation as resolved.
Show resolved Hide resolved
margin-top: 0.125em;
}

[part='name'] {
font-weight: 500;
margin-inline-end: auto;
Peppe marked this conversation as resolved.
Show resolved Hide resolved
Peppe marked this conversation as resolved.
Show resolved Hide resolved
}

[part='time'] {
color: var(--material-secondary-text-color);
font-size: var(--material-caption-font-size);
}

[part='message'] {
color: var(--material-secondary-text-color);
font-size: var(--material-small-font-size);
line-height: 1.25rem;
}
`,
{ moduleId: 'material-message' }
Expand Down