Skip to content

Commit 553ec6a

Browse files
authored
Modernizes visual appearance of tabs (#751)
Updates the .interactive-tabs class to take a more layered appearance. Hover and selection states are visually distinct and rely on the existing color palette for layers. Adds support for "prefers-contrast: more" to use the previous higher contrast style. Moves the css for tabs to a common location so it can be easily found and reused between pages.
1 parent f99ab22 commit 553ec6a

File tree

4 files changed

+70
-55
lines changed

4 files changed

+70
-55
lines changed

assets/stylesheets/_elements.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
@import "elements/banner";
2+
@import "elements/tabs";

assets/stylesheets/_screen.scss

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,56 +1194,3 @@ article {
11941194
}
11951195
}
11961196
}
1197-
1198-
.interactive-tabs {
1199-
.tabs {
1200-
display: flex;
1201-
flex-direction: row;
1202-
gap: 1rem;
1203-
padding: 0;
1204-
1205-
button, a {
1206-
cursor: pointer;
1207-
background-color: transparent;
1208-
border-radius: var(--border-radius);
1209-
border: 1px solid var(--color-text);
1210-
color: var(--color-text);
1211-
padding: .5rem;
1212-
display: block;
1213-
text-align: center;
1214-
grid-template-columns: repeat(3, 1fr);
1215-
1216-
&:hover, &[aria-pressed="true"] {
1217-
background-color: var(--color-text);
1218-
color: var(--color-fill);
1219-
text-decoration: none;
1220-
}
1221-
}
1222-
1223-
@media (max-width: 480px) {
1224-
flex-direction: column;
1225-
gap: 0.5rem;
1226-
}
1227-
}
1228-
1229-
.content {
1230-
display: none;
1231-
1232-
&.active {
1233-
display: block;
1234-
}
1235-
}
1236-
}
1237-
1238-
.interactive-tabs.os {
1239-
.tabs {
1240-
button, a {
1241-
width: 100%;
1242-
align-content: center;
1243-
}
1244-
}
1245-
}
1246-
1247-
.interactive-tabs ~ [id] {
1248-
scroll-margin-top: 5rem;
1249-
}

assets/stylesheets/core/_colors.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ $base-colors: (
2828
dark: rgb(22, 22, 22),
2929
),
3030
fill-tertiary: (
31-
light: rgb(240, 240, 240),
31+
light: rgb(232, 232, 232),
3232
dark: rgb(42, 42, 42),
3333
),
3434
fill-quaternary: (
35-
light: rgb(220, 220, 220),
35+
light: rgb(218, 218, 218),
3636
dark: rgb(66, 66, 66),
3737
),
3838
fill-gray-tertiary: (
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
.interactive-tabs {
2+
.tabs {
3+
display: flex;
4+
flex-direction: row;
5+
gap: 1rem;
6+
padding: 0;
7+
8+
// "a" used on install page, "button" used on packages package
9+
a, button {
10+
background-color: var(--color-fill-secondary);
11+
border: 1px solid var(--color-fill-tertiary);
12+
border-radius: var(--border-radius);
13+
color: var(--color-text);
14+
15+
// FIXME: Sink prefers-contrast lower into the color stack so each element doesn't need to
16+
@media (prefers-contrast: more) {
17+
background-color: transparent;
18+
border: 1px solid var(--color-text);
19+
}
20+
21+
cursor: pointer;
22+
padding: .5rem;
23+
display: block;
24+
text-align: center;
25+
width: 100%;
26+
grid-template-columns: repeat(3, 1fr);
27+
28+
&:hover {
29+
color: var(--color-link);
30+
}
31+
32+
&[aria-pressed="true"] {
33+
color: var(--color-text);
34+
font-weight: 500;
35+
}
36+
37+
&:hover, &[aria-pressed="true"] {
38+
background-color: var(--color-fill-tertiary);
39+
border: 1px solid var(--color-fill-quaternary);
40+
41+
@media (prefers-contrast: more) {
42+
background-color: var(--color-text);
43+
color: var(--color-fill);
44+
}
45+
46+
text-decoration: none;
47+
}
48+
}
49+
50+
@media (max-width: 480px) {
51+
flex-direction: column;
52+
gap: 0.5rem;
53+
}
54+
}
55+
56+
.content {
57+
display: none;
58+
59+
&.active {
60+
display: block;
61+
}
62+
}
63+
}
64+
65+
.interactive-tabs ~ [id] {
66+
scroll-margin-top: 5rem;
67+
}

0 commit comments

Comments
 (0)