Skip to content

Commit e97d937

Browse files
authored
Merge pull request #363 from patternfly/US198278-tab-design-updates
US198278 tab design updates
2 parents 4ae1bd0 + 4889ba4 commit e97d937

File tree

16 files changed

+425
-326
lines changed

16 files changed

+425
-326
lines changed

elements/pfe-accordion/demo/pfe-accordion.story.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@ stories.add(PfeAccordion.tag, () => {
2020
let config = {};
2121
// const props = PfeAccordion.properties;
2222
// const slots = PfeAccordion.slots;
23+
const props = {
24+
on: {
25+
title: "Theme",
26+
type: "string",
27+
enum: [
28+
"light",
29+
"dark"
30+
],
31+
default: "light"
32+
}
33+
};
34+
35+
config.prop = tools.autoPropKnobs(props, storybookBridge);
2336

2437
//-- Add content to light DOM
2538
config.slots = [];

elements/pfe-content-set/demo/index.html

Lines changed: 103 additions & 72 deletions
Large diffs are not rendered by default.

elements/pfe-content-set/demo/pfe-content-set.story.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,10 @@ stories.add(PfeContentSet.tag, () => {
3030

3131
const variantLabel = "Variant";
3232
const variantOptions = {
33-
"": "default",
34-
primary: "Primary",
35-
secondary: "Secondary"
33+
wind: "wind",
34+
earth: "earth"
3635
};
37-
const variantDefault = "";
36+
const variantDefault = "wind";
3837
const variant = select(variantLabel, variantOptions, variantDefault);
3938
const variantAttr = variant ? ` pfe-variant="${variant}"` : "";
4039

@@ -55,7 +54,7 @@ stories.add(PfeContentSet.tag, () => {
5554
.map((item, i) =>
5655
sets.push({
5756
heading: lorem(headingConfig).replace(/^\w/, c => c.toUpperCase()),
58-
panel: `<h2>${lorem(headingConfig).replace(/^\w/, c =>
57+
panel: `<h2 style="margin-top: 0;">${lorem(headingConfig).replace(/^\w/, c =>
5958
c.toUpperCase()
6059
)}</h2>
6160
${lorem({
@@ -73,7 +72,7 @@ ${Array(countVar)
7372
.split(0)
7473
.map(
7574
(item, i) => `
76-
<h2 pfe-content-set--header>${sets[i].heading}</h2>
75+
<h3 pfe-content-set--header style="margin: 0;">${sets[i].heading}</h3>
7776
<div pfe-content-set--panel>
7877
${sets[i].panel}
7978
</div>`)

elements/pfe-content-set/src/pfe-content-set.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,14 @@ class PfeContentSet extends PFElement {
3232
get settings() {
3333
let settings = {};
3434
const variant = this.getAttribute("pfe-variant");
35+
const theme = this.getAttribute("on");
3536

36-
if (variant === "primary") {
37+
if (variant) {
3738
settings.variant = variant;
38-
settings.color = "striped";
39-
} else if (variant === "secondary") {
40-
settings.variant = variant;
41-
settings.color = "dark";
42-
} else {
43-
settings.color = "lightest";
39+
}
40+
41+
if (theme) {
42+
settings.theme = theme
4443
}
4544

4645
return settings;
@@ -93,9 +92,9 @@ class PfeContentSet extends PFElement {
9392
// Append the accordion to the document fragment
9493
fragment.appendChild(accordion);
9594

96-
// Pass the color property down to the accordion component
97-
if (this.settings.color) {
98-
accordion.setAttribute("color", this.settings.color);
95+
// Pass the theme property down to the accordion component
96+
if (this.settings.theme) {
97+
accordion.setAttribute("on", this.settings.theme);
9998
}
10099

101100
// Append the fragment to the component
@@ -147,6 +146,11 @@ class PfeContentSet extends PFElement {
147146
tabs.setAttribute("pfe-variant", this.settings.variant);
148147
}
149148

149+
// Pass the theme property down to the accordion component
150+
if (this.settings.theme) {
151+
tabs.setAttribute("on", this.settings.theme);
152+
}
153+
150154
// Append the fragment to the component
151155
this.appendChild(fragment);
152156
}

elements/pfe-content-set/test/pfe-content-set_test.html

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ <h2 pfe-content-set--header>heading 3</h2>
2020
</div>
2121

2222
<div style="width: 600px;">
23-
<pfe-content-set pfe-variant="primary" id="primary">
23+
<pfe-content-set pfe-variant="wind" id="wind">
2424
<h2 pfe-content-set--header>heading 1</h2>
2525
<p pfe-content-set--panel>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
2626
<h2 pfe-content-set--header>heading 2</h2>
@@ -31,7 +31,7 @@ <h2 pfe-content-set--header>heading 3</h2>
3131
</div>
3232

3333
<div style="width: 1024px;">
34-
<pfe-content-set pfe-variant="secondary" id="secondary">
34+
<pfe-content-set pfe-variant="earth" id="earth">
3535
<h2 pfe-content-set--header>heading 1</h2>
3636
<p pfe-content-set--panel>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
3737
<h2 pfe-content-set--header>heading 2</h2>
@@ -46,7 +46,7 @@ <h2 pfe-content-set--header>heading 5</h2>
4646
</div>
4747

4848
<div style="width: 1024px;">
49-
<pfe-content-set vertical pfe-variant="secondary" id="secondary-vertical">
49+
<pfe-content-set vertical pfe-variant="earth" id="earth-vertical">
5050
<h2 pfe-content-set--header>heading 1</h2>
5151
<p pfe-content-set--panel>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
5252
<h2 pfe-content-set--header>heading 2</h2>
@@ -75,27 +75,26 @@ <h2 pfe-content-set--header>heading 3</h2>
7575
assert.equal(thirdHeader.getAttribute('aria-selected'), 'false');
7676
});
7777

78-
test('it should be a striped accordion', () => {
79-
const pfeAccordion = document.querySelector('#primary').querySelector("pfe-accordion");
78+
test('it should be a light accordion', () => {
79+
const pfeAccordion = document.querySelector('#wind').querySelector("pfe-accordion");
8080
const firstHeader = pfeAccordion.querySelector('pfe-accordion-header:nth-child(1)');
8181
const thirdHeader = pfeAccordion.querySelector('pfe-accordion-header:nth-child(5)');
82-
const firstPanel = document.querySelector('#primary').querySelector("pfe-accordion-panel:nth-child(2)");
82+
const firstPanel = document.querySelector('#wind').querySelector("pfe-accordion-panel:nth-child(2)");
8383
const secondPanel = pfeAccordion.querySelector('pfe-accordion-panel:nth-child(4)');
8484

8585
assert.isTrue(firstHeader.hasAttribute('aria-controls'));
86-
assert.equal(firstHeader.getAttribute('color'), 'striped');
8786
assert.isTrue(thirdHeader.hasAttribute('aria-controls'));
8887
assert.isTrue(firstPanel.hasAttribute('aria-labelledby'));
8988
assert.isTrue(secondPanel.hasAttribute('aria-labelledby'));
9089
});
9190

9291
test('it should have dark tabs', () => {
93-
const pfeTabs = document.querySelector('#secondary').querySelector("pfe-tabs");
92+
const pfeTabs = document.querySelector('#earth').querySelector("pfe-tabs");
9493
const firstHeader = pfeTabs.querySelector('pfe-tab:nth-child(1)');
9594
const secondHeader = pfeTabs.querySelector('pfe-tab:nth-child(3)');
9695
const fifthHeader = pfeTabs.querySelector('pfe-tab:nth-child(9)');
9796

98-
assert.equal(pfeTabs.getAttribute('pfe-variant'), 'secondary');
97+
assert.equal(pfeTabs.getAttribute('pfe-variant'), 'earth');
9998
assert.equal(firstHeader.getAttribute('tabindex'), '0');
10099
assert.equal(firstHeader.getAttribute('aria-selected'), 'true');
101100
assert.equal(secondHeader.getAttribute('aria-selected'), 'false');
@@ -104,11 +103,11 @@ <h2 pfe-content-set--header>heading 3</h2>
104103
});
105104

106105
test('it should have vertical tabs', () => {
107-
const pfeTabs = document.querySelector('#secondary-vertical').querySelector("pfe-tabs");
106+
const pfeTabs = document.querySelector('#earth-vertical').querySelector("pfe-tabs");
108107
const firstHeader = pfeTabs.querySelector('pfe-tab:nth-child(1)');
109108
const secondHeader = pfeTabs.querySelector('pfe-tab:nth-child(3)');
110109
assert.isTrue(pfeTabs.hasAttribute('vertical'));
111-
assert.equal(pfeTabs.getAttribute('pfe-variant'), 'secondary');
110+
assert.equal(pfeTabs.getAttribute('pfe-variant'), 'earth');
112111
assert.equal(firstHeader.getAttribute('tabindex'), '0');
113112
assert.equal(firstHeader.getAttribute('aria-selected'), 'true');
114113
assert.equal(secondHeader.getAttribute('aria-selected'), 'false');

elements/pfe-sass/mixins/_mixins.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
--pfe-broadcasted--color--ui-link--hover: #{pfe-color(surface--complement--link--hover)};
8585
--pfe-broadcasted--color--ui-link--focus: #{pfe-color(surface--complement--link--focus)};
8686
}
87+
8788
@else if $theme == lighter {
8889
--pfe-broadcasted--color--text: #{pfe-color(surface--lighter--text)};
8990
--pfe-broadcasted--color--ui-link: #{pfe-color(surface--lighter--link)};

elements/pfe-sass/variables/_crayola.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ $pfelements--gray-light: #d2d2d2 !default;
3333
$pfelements--gray-dark: #333 !default;
3434

3535
// Other tertiary named colors to be used below
36-
$pfelements--red: #c00 !default;
36+
$pfelements--red: #e00 !default; // Was #c00
3737
$pfelements--yellow: #f0ab00 !default;
3838
$pfelements--cyan: #007a87 !default;
3939
$pfelements--purple: rebeccapurple !default; // Was #703fec

elements/pfe-sass/variables/_maps.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ $pfe-colors: (
5353
ui-disabled--text: $pfe-color--ui-disabled--text,
5454
ui-disabled--text--hover: $pfe-color--ui-disabled--text--hover,
5555

56-
5756
// ========================================================================
5857
// Base Surface Colors for Container elements
5958
// ========================================================================

0 commit comments

Comments
 (0)