Skip to content

Commit 8fa0920

Browse files
committed
fix(jump-links)!: implement context API
1 parent 36f35e5 commit 8fa0920

File tree

2 files changed

+29
-12
lines changed

2 files changed

+29
-12
lines changed

elements/pfe-jump-links/pfe-jump-links-nav.scss

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,6 @@ a {
175175
color: pfe-broadcasted(text);
176176
}
177177

178-
// Note: there is no ui-disabled--text--on-dark to pull from
179-
@each $context in (dark, saturated) {
180-
:host([on="#{$context}"]) & {
181-
color: pfe-var(text--muted--on-#{$context});
182-
}
183-
}
184-
185178
.has-sub-section & {
186179
padding-bottom: pfe-local(vertical-spacer, $region: link);
187180
}
@@ -376,3 +369,11 @@ pfe-accordion-panel.animating {
376369
:host([hidden]) {
377370
display: none !important;
378371
}
372+
373+
// Note: there is no ui-disabled--text--on-dark to pull from
374+
@each $context in (dark, saturated) {
375+
:host([on="#{$context}"]) a {
376+
color: pfe-var(text--muted--on-#{$context});
377+
}
378+
}
379+

elements/pfe-jump-links/pfe-jump-links-nav.ts

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { LitElement, html } from 'lit';
22
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
33
import { customElement, property, query, state } from 'lit/decorators.js';
44

5-
import { ComposedEvent } from '@patternfly/pfe-core';
6-
import { pfelement, bound, observed } from '@patternfly/pfe-core/decorators.js';
5+
import { ColorPalette, ColorTheme, ComposedEvent } from '@patternfly/pfe-core';
6+
import { pfelement, bound, observed, colorContextConsumer, deprecation, colorContextProvider } from '@patternfly/pfe-core/decorators.js';
77
import { getRandomId } from '@patternfly/pfe-core/functions/random.js';
88
import { deprecatedCustomEvent } from '@patternfly/pfe-core/functions/deprecatedCustomEvent.js';
99

@@ -125,9 +125,25 @@ export class PfeJumpLinksNav extends LitElement {
125125
*/
126126
@property({ type: String, reflect: true, attribute: 'sr-text' }) srText = 'Jump to section';
127127

128-
// Supports only lightest and darkest background colors
129-
/** Color */
130-
@property({ type: String, reflect: true }) color: 'lightest'|'darkest' = 'lightest';
128+
/**
129+
* Sets color palette, which affects the element's styles as well as descendants' color theme.
130+
* Overrides parent color context.
131+
* Your theme will influence these colors so check there first if you are seeing inconsistencies.
132+
* See [CSS Custom Properties](#css-custom-properties) for default values
133+
*
134+
* Card always resets its context to `base`, unless explicitly provided with a `color-palette`.
135+
*/
136+
@colorContextProvider()
137+
@property({ reflect: true, attribute: 'color-palette' }) colorPalette?: ColorPalette;
138+
139+
/** @deprecated use `color-palette` */
140+
@deprecation({ alias: 'colorPalette', attribute: 'color' }) color?: ColorPalette;
141+
142+
/**
143+
* Sets color theme based on parent context
144+
*/
145+
@colorContextConsumer()
146+
@property({ reflect: true }) on?: ColorTheme;
131147

132148
// @TODO Need to incorporate support for breakpoint customizations i.e., offset="@500px: 200, @800px: 150"
133149
/**

0 commit comments

Comments
 (0)