-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use new listen and observes decorators
- Loading branch information
1 parent
5ec3e01
commit 13d7511
Showing
4 changed files
with
32 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ import { InternalsController } from '@patternfly/pfe-core/controllers/internals- | |
|
||
import style from './pf-jump-links-item.css'; | ||
|
||
import { observed } from '@patternfly/pfe-core/decorators/observed.js'; | ||
import { observes } from '@patternfly/pfe-core/decorators/observes.js'; | ||
|
||
/** | ||
* @cssprop --pf-c-jump-links__link--PaddingTop -- padding around the link | ||
|
@@ -28,29 +28,28 @@ export class PfJumpLinksItem extends LitElement { | |
}; | ||
|
||
/** Whether this item is active. */ | ||
@observed('activeChanged') | ||
@property({ type: Boolean, reflect: true }) active = false; | ||
|
||
/** hypertext reference for this link */ | ||
@property({ reflect: true }) href?: string; | ||
|
||
#internals = InternalsController.of(this, { role: 'listitem' }); | ||
|
||
override connectedCallback() { | ||
super.connectedCallback(); | ||
this.activeChanged(); | ||
} | ||
#internals = InternalsController.of(this, { | ||
role: 'listitem', | ||
}); | ||
|
||
render() { | ||
return html` | ||
<a href="${ifDefined(this.href)}" @focus="${this.#onFocus}" @click="${this.#onClick}"> | ||
<a href="${ifDefined(this.href)}" | ||
@focus="${this.#onFocus}" | ||
@click="${this.#onClick}"> | ||
<slot></slot> | ||
</a> | ||
<slot name="subsection"></slot> | ||
`; | ||
} | ||
|
||
private activeChanged() { | ||
@observes('active') | ||
protected activeChanged() { | ||
this.#internals.ariaCurrent = this.active ? 'location' : null; | ||
Check failure on line 53 in elements/pf-jump-links/pf-jump-links-item.ts GitHub Actions / SSR Tests (Playwright)elements/pf-jump-links/test/pf-jump-links.e2e.ts:14:3 › pf-jump-links › ssr
|
||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters