Skip to content

Commit 39740d0

Browse files
committed
origin/US198278-tab-design-updates copy variant to panel, update panel mixin to use arguments for borders & padding
1 parent 32659ea commit 39740d0

File tree

4 files changed

+40
-27
lines changed

4 files changed

+40
-27
lines changed

elements/pfe-sass/mixins/_mixins.scss

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -355,14 +355,19 @@
355355
--pfe-tabs--aux: #{pfe-color(ui-tab--dark-hover-color)};
356356
}
357357

358-
@mixin pfe-tab-panel-container {
359-
border: #{pfe-var(ui--border-width)} #{pfe-var(ui--border-style)} #{pfe-color(surface--border)};
360-
border-top: none;
361-
padding: #{pfe-var(container-spacer)};
362-
padding: calc(#{pfe-var(container-spacer)} * 2);
358+
@mixin pfe-tab-panel-container($orientation: "horizontal", $border: false) {
359+
padding: #{pfe-var(container-spacer)} 0;
360+
@if $orientation == "vertical" {
361+
padding-left: calc(#{pfe-var(container-spacer)} * 2);
362+
}
363+
@if $border {
364+
padding: calc(#{pfe-var(container-spacer)} * 2);
365+
border: #{pfe-var(ui--border-width)} #{pfe-var(ui--border-style)} #{pfe-color(surface--border)};
366+
@if $orientation == "horizontal" {
367+
border-top: none;
368+
}
369+
@if $orientation == "vertical" {
370+
border-left: none;
371+
}
372+
}
363373
}
364-
365-
@mixin pfe-tab-panel-container-vertical {
366-
border: #{pfe-var(ui--border-width)} #{pfe-var(ui--border-style)} #{pfe-color(surface--border)};
367-
border-left: none;
368-
}

elements/pfe-tabs/demo/index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
<title>PatternFly Elements: pfe-tabs Demo</title>
66

77
<link rel="stylesheet" href="http://overpass-30e2.kxcdn.com/overpass.css" />
8+
9+
<!--
810
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap-reboot.css">
911
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/typebase.css/0.5.0/typebase.css">
10-
<!-- <link rel="stylesheet" href="../../../themes/cp-theme/cp-theme.css" /> -->
12+
<link rel="stylesheet" href="../../../themes/cp-theme/cp-theme.css" /> -->
1113

1214
<!-- uncomment the es5-adapter if you're using the umd version -->
1315
<script src="/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js"></script>

elements/pfe-tabs/src/pfe-tab-panel.scss

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,27 @@
33
:host {
44
display: block;
55
color: var(--pfe-broadcasted--color--text);
6-
7-
.container {
8-
@include pfe-tab-panel-container;
9-
}
106
}
117

128
:host([hidden]) {
139
display: none;
1410
}
1511

16-
:host([vertical]) {
12+
/* Horizontal */
13+
:host([pfe-variant="wind"]) .container {
14+
@include pfe-tab-panel-container;
15+
}
16+
17+
:host([pfe-variant="earth"]) .container {
18+
@include pfe-tab-panel-container($border: true);
19+
}
1720

18-
.container {
19-
@include pfe-tab-panel-container-vertical;
20-
}
21+
/* Vertical */
22+
:host([pfe-variant="wind"][vertical]) .container {
23+
@include pfe-tab-panel-container($orientation: "vertical");
2124
}
25+
26+
:host([pfe-variant="earth"][vertical]) .container {
27+
@include pfe-tab-panel-container($orientation: "vertical", $border: true);
28+
}
29+

elements/pfe-tabs/src/pfe-tabs.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class PfeTabs extends PFElement {
123123
}
124124

125125
static get observedAttributes() {
126-
return ["vertical", "selected-index", "pfe-variant", "on"];
126+
return ["vertical", "selected-index", "pfe-variant"];
127127
}
128128

129129
get selectedIndex() {
@@ -181,17 +181,15 @@ class PfeTabs extends PFElement {
181181
this._allTabs().forEach(tab =>
182182
tab.setAttribute("pfe-variant", "wind")
183183
);
184+
this._allPanels().forEach(panel =>
185+
panel.setAttribute("pfe-variant", "wind")
186+
);
184187
} else if (this.getAttribute("pfe-variant") === "earth") {
185188
this._allTabs().forEach(tab =>
186189
tab.setAttribute("pfe-variant", "earth")
187190
);
188-
}
189-
break;
190-
191-
case "on":
192-
if (this.getAttribute("on") === "dark") {
193-
this._allTabs().forEach(tab =>
194-
tab.setAttribute("on", "dark")
191+
this._allPanels().forEach(panel =>
192+
panel.setAttribute("pfe-variant", "earth")
195193
);
196194
}
197195
break;

0 commit comments

Comments
 (0)