-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathmenu-item.js
More file actions
42 lines (37 loc) · 1.02 KB
/
menu-item.js
File metadata and controls
42 lines (37 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import '../icons/icon.js';
import { css, html, LitElement } from 'lit';
import { MenuItemMixin } from './menu-item-mixin.js';
import { menuItemStyles } from './menu-item-styles.js';
/**
* A menu item component used with JS handlers.
* @slot - Default content placed inside of the component
* @slot supporting - Allows supporting information to be displayed on the right-most side of the menu item
*/
class MenuItem extends MenuItemMixin(LitElement) {
static get styles() {
return [ menuItemStyles,
css`
:host {
align-items: center;
display: flex;
padding: 0.75rem 1rem;
}
d2l-icon {
flex: none;
margin-inline-start: 6px;
}
`
];
}
render() {
const icon = this.hasChildView ?
html`<d2l-icon icon="tier1:chevron-right"></d2l-icon>` : null;
return html`
<div class="d2l-menu-item-text">${this.text}</div>
<div class="d2l-menu-item-supporting"><slot name="supporting"></slot></div>
${icon}
<slot></slot>
`;
}
}
customElements.define('d2l-menu-item', MenuItem);