use classMap instead of inline style

pull/831/head
Cory LaViska 2022-07-19 09:06:12 -04:00
rodzic 7e581e6ad7
commit ecf5ab5aad
1 zmienionych plików z 10 dodań i 3 usunięć

Wyświetl plik

@ -1,5 +1,6 @@
import { html, LitElement } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import { classMap } from 'lit/directives/class-map.js';
import { autoIncrement } from '../../internal/auto-increment';
import styles from './tab-panel.styles';
import type { CSSResultGroup } from 'lit';
@ -33,10 +34,16 @@ export default class SlTabPanel extends LitElement {
}
render() {
this.style.display = this.active ? 'block' : 'none';
return html`
<div part="base" class="tab-panel" role="tabpanel" aria-hidden=${this.active ? 'false' : 'true'}>
<div
part="base"
class=${classMap({
'tab-panel': true,
'tab-panel--active': this.active
})}
role="tabpanel"
aria-hidden=${this.active ? 'false' : 'true'}
>
<slot></slot>
</div>
`;