kopia lustrzana https://github.com/shoelace-style/shoelace
use classMap instead of inline style
rodzic
7e581e6ad7
commit
ecf5ab5aad
|
@ -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>
|
||||
`;
|
||||
|
|
Ładowanie…
Reference in New Issue