Skip to content

Commit 514e7ee

Browse files
committed
Fix tabs
1 parent 8131469 commit 514e7ee

File tree

10 files changed

+49
-25
lines changed

10 files changed

+49
-25
lines changed

dist/spectre.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2768,7 +2768,7 @@ summary.accordion-header::-webkit-details-marker {
27682768
padding-right: 0;
27692769
}
27702770
.tab > input[type=radio] {
2771-
opacity: 0;
2771+
left: -100%;
27722772
position: absolute;
27732773
}
27742774
.tab > input[type=radio]:checked + .tab-item {

dist/spectre.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/components/panels.html

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,17 @@ <h3 class="s-title">Panels<a class="anchor" href="#panels" aria-hidden="true">#<
210210
<div class="panel-subtitle">THE HULK</div>
211211
</div>
212212
<nav class="panel-nav">
213-
<ul class="tab tab-block">
214-
<li class="tab-item active"><a href="#panels">Profile</a></li>
215-
<li class="tab-item"><a href="#panels">Files</a></li>
216-
<li class="tab-item"><a href="#panels">Tasks</a></li>
217-
</ul>
213+
<div class="tab tab-block">
214+
<input type="radio" name="tab" id="tab-1" checked>
215+
<div class="tab-item" for="tab-1">Profile</div>
216+
<input type="radio" name="tab" id="tab-2">
217+
<div class="tab-item" for="tab-2">Files</div>
218+
<input type="radio" name="tab" id="tab-3">
219+
<div class="tab-item" for="tab-3">Tasks</div>
220+
<div class="tab-panel"></div>
221+
<div class="tab-panel"></div>
222+
<div class="tab-panel"></div>
223+
</div>
218224
</nav>
219225
<div class="panel-body">
220226
<div class="tile tile-centered">

docs/dist/spectre-rtl.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2769,7 +2769,7 @@ summary.accordion-header::-webkit-details-marker {
27692769
padding-right: 0;
27702770
}
27712771
.tab > input[type=radio] {
2772-
opacity: 0;
2772+
left: -100%;
27732773
position: absolute;
27742774
}
27752775
.tab > input[type=radio]:checked + .tab-item {

docs/dist/spectre-rtl.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/dist/spectre.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2768,7 +2768,7 @@ summary.accordion-header::-webkit-details-marker {
27682768
padding-right: 0;
27692769
}
27702770
.tab > input[type=radio] {
2771-
opacity: 0;
2771+
left: -100%;
27722772
position: absolute;
27732773
}
27742774
.tab > input[type=radio]:checked + .tab-item {

docs/dist/spectre.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/src/components/panels.pug

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,19 @@ block docs-content
2121
.panel-title.h5.mt-10 Bruce Banner
2222
.panel-subtitle THE HULK
2323
nav.panel-nav
24-
ul.tab.tab-block
25-
li.tab-item.active
26-
a(href="#panels")
27-
| Profile
28-
li.tab-item
29-
a(href="#panels")
30-
| Files
31-
li.tab-item
32-
a(href="#panels")
33-
| Tasks
24+
.tab.tab-block
25+
input(type="radio" name="tab" id="tab-1" checked)
26+
.tab-item(for="tab-1")
27+
| Profile
28+
input(type="radio" name="tab" id="tab-2")
29+
.tab-item(for="tab-2")
30+
| Files
31+
input(type="radio" name="tab" id="tab-3")
32+
.tab-item(for="tab-3")
33+
| Tasks
34+
.tab-panel
35+
.tab-panel
36+
.tab-panel
3437
.panel-body
3538
.tile.tile-centered
3639
.tile-content
@@ -127,4 +130,4 @@ block docs-content
127130

128131
include ../_layout/_ad-c.pug
129132

130-
include ../_layout/_footer.pug
133+
include ../_layout/_footer.pug

src/_buttons.scss

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,37 @@
1818
user-select: none;
1919
vertical-align: middle;
2020
white-space: nowrap;
21+
2122
&:visited {
2223
color: $primary-color-dark;
2324
}
25+
2426
&:focus {
2527
@include control-shadow();
2628
}
29+
2730
&:focus,
2831
&:hover {
2932
background: $secondary-color;
3033
border-color: $primary-color-dark;
3134
text-decoration: none;
3235
}
36+
3337
&:active,
3438
&.active {
3539
background: $primary-color-dark;
3640
border-color: darken($primary-color-dark, 5%);
3741
color: $light-color;
3842
text-decoration: none;
43+
3944
&.loading {
4045
&::after {
4146
border-bottom-color: $light-color;
4247
border-left-color: $light-color;
4348
}
4449
}
4550
}
51+
4652
&[disabled],
4753
&:disabled,
4854
&.disabled {
@@ -56,21 +62,25 @@
5662
background: $primary-color;
5763
border-color: $primary-color-dark;
5864
color: $light-color;
65+
5966
&:visited {
6067
color: $light-color;
6168
}
69+
6270
&:focus,
6371
&:hover {
6472
background: darken($primary-color-dark, 2%);
6573
border-color: darken($primary-color-dark, 5%);
6674
color: $light-color;
6775
}
76+
6877
&:active,
6978
&.active {
7079
background: darken($primary-color-dark, 4%);
7180
border-color: darken($primary-color-dark, 7%);
7281
color: $light-color;
7382
}
83+
7484
&.loading {
7585
&::after {
7686
border-bottom-color: $light-color;
@@ -93,6 +103,7 @@
93103
background: transparent;
94104
border-color: transparent;
95105
color: $link-color;
106+
96107
&:visited,
97108
&:focus,
98109
&:hover,
@@ -169,19 +180,23 @@
169180

170181
.btn {
171182
flex: 1 0 auto;
183+
172184
&:first-child:not(:last-child) {
173185
border-bottom-right-radius: 0;
174186
border-top-right-radius: 0;
175187
}
188+
176189
&:not(:first-child):not(:last-child) {
177190
border-radius: 0;
178191
margin-left: -$border-width;
179192
}
193+
180194
&:last-child:not(:first-child) {
181195
border-bottom-left-radius: 0;
182196
border-top-left-radius: 0;
183197
margin-left: -$border-width;
184198
}
199+
185200
&:focus,
186201
&:hover,
187202
&:active,

src/_tabs.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
.tab-item {
99
border-bottom: $border-width-lg solid transparent;
1010
color: inherit;
11+
cursor: pointer;
1112
display: block;
1213
margin: 0 $unit-2 0 0;
1314
padding: $unit-2 $unit-1 $unit-2 - $border-width-lg $unit-1;
1415
text-decoration: none;
15-
cursor: pointer;
1616

1717
&:focus,
1818
&:hover {
@@ -54,7 +54,7 @@
5454

5555
> input[type="radio"] {
5656
position: absolute;
57-
opacity: 0;
57+
left: -100%;
5858

5959
&:checked + .tab-item {
6060
border-bottom-color: $primary-color;
@@ -69,8 +69,8 @@
6969
}
7070

7171
.tab-panel {
72+
border-top: $border-width solid $border-color;
7273
display: none;
7374
flex-basis: 100%;
74-
border-top: $border-width solid $border-color;
7575
}
7676
}

0 commit comments

Comments
 (0)