Skip to content

Commit

Permalink
fix(card): make slot controller private
Browse files Browse the repository at this point in the history
  • Loading branch information
bennypowers committed Mar 31, 2024
1 parent 4d6f539 commit 66af796
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions elements/pf-card/pf-card.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { customElement } from 'lit/decorators/custom-element.js';
import { LitElement, html } from 'lit';
import { SlotController } from '@patternfly/pfe-core/controllers/slot-controller.js';

import { customElement } from 'lit/decorators/custom-element.js';
import { property } from 'lit/decorators/property.js';
import { classMap } from 'lit/directives/class-map.js';

import { property } from 'lit/decorators/property.js';
import { SlotController } from '@patternfly/pfe-core/controllers/slot-controller.js';

import style from './pf-card.css';

Expand Down Expand Up @@ -80,24 +79,24 @@ export class PfCard extends LitElement {
*/
@property({ type: Boolean, reflect: true }) plain = false;

protected slots = new SlotController(this, 'header', null, 'footer');
#slots = new SlotController(this, 'header', null, 'footer');

render() {
return html`
<article>
<header id="header"
part="header"
class="${classMap({ empty: !this.slots.hasSlotted('header') })}">
class="${classMap({ empty: this.#slots.isEmpty('header') })}">
<slot name="header"></slot>
</header>
<div id="body"
part="body"
class="${classMap({ empty: !this.querySelector(':not([slot])') })}">
class="${classMap({ empty: this.#slots.isEmpty(null) })}">
<slot></slot>
</div>
<footer id="footer"
part="footer"
class="${classMap({ empty: !this.slots.hasSlotted('footer') })}">
class="${classMap({ empty: this.#slots.isEmpty('footer') })}">
<slot name="footer"></slot>
</footer>
</article>
Expand Down

0 comments on commit 66af796

Please sign in to comment.