@stackoverflow/stacks 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +47 -47
  2. package/dist/controllers/s-popover.d.ts +11 -2
  3. package/dist/css/stacks.css +257 -8
  4. package/dist/css/stacks.min.css +1 -1
  5. package/dist/js/stacks.js +18 -2
  6. package/dist/js/stacks.min.js +1 -1
  7. package/lib/css/atomic/borders.less +378 -378
  8. package/lib/css/atomic/colors.less +209 -209
  9. package/lib/css/atomic/flex.less +375 -375
  10. package/lib/css/atomic/grid.less +174 -174
  11. package/lib/css/atomic/misc.less +343 -343
  12. package/lib/css/atomic/spacing.less +342 -314
  13. package/lib/css/atomic/typography.less +273 -273
  14. package/lib/css/atomic/width-height.less +194 -194
  15. package/lib/css/base/body.less +44 -44
  16. package/lib/css/base/configuration-static.less +61 -61
  17. package/lib/css/base/icons.less +20 -20
  18. package/lib/css/base/internals.less +220 -220
  19. package/lib/css/base/reset-meyer.less +64 -64
  20. package/lib/css/base/reset-normalize.less +449 -449
  21. package/lib/css/base/reset.less +20 -20
  22. package/lib/css/components/activity-indicator.less +44 -45
  23. package/lib/css/components/avatars.less +189 -189
  24. package/lib/css/components/badges.less +254 -209
  25. package/lib/css/components/banners.less +80 -80
  26. package/lib/css/components/blank-states.less +26 -26
  27. package/lib/css/components/breadcrumbs.less +44 -44
  28. package/lib/css/components/button-groups.less +104 -104
  29. package/lib/css/components/buttons.less +665 -665
  30. package/lib/css/components/cards.less +44 -44
  31. package/lib/css/components/code-blocks.less +130 -130
  32. package/lib/css/components/collapsible.less +104 -104
  33. package/lib/css/components/inputs.less +728 -728
  34. package/lib/css/components/link-previews.less +136 -136
  35. package/lib/css/components/links.less +218 -218
  36. package/lib/css/components/menu.less +47 -47
  37. package/lib/css/components/modals.less +133 -133
  38. package/lib/css/components/navigation.less +146 -146
  39. package/lib/css/components/notices.less +233 -233
  40. package/lib/css/components/page-titles.less +60 -60
  41. package/lib/css/components/pagination.less +55 -55
  42. package/lib/css/components/popovers.less +197 -197
  43. package/lib/css/components/post-summary.less +436 -425
  44. package/lib/css/components/progress-bars.less +330 -330
  45. package/lib/css/components/prose.less +503 -503
  46. package/lib/css/components/spinner.less +107 -107
  47. package/lib/css/components/tables.less +341 -341
  48. package/lib/css/components/tags.less +236 -236
  49. package/lib/css/components/toggle-switches.less +144 -144
  50. package/lib/css/components/topbar.less +427 -427
  51. package/lib/css/components/uploader.less +210 -210
  52. package/lib/css/components/user-cards.less +169 -169
  53. package/lib/css/components/widget-dynamic.less +33 -33
  54. package/lib/css/components/widget-static.less +273 -273
  55. package/lib/css/exports/constants-colors.less +1092 -1092
  56. package/lib/css/exports/constants-helpers.less +108 -108
  57. package/lib/css/exports/constants-type.less +153 -153
  58. package/lib/css/exports/exports.less +15 -15
  59. package/lib/css/exports/mixins.less +237 -237
  60. package/lib/css/stacks-dynamic.less +35 -35
  61. package/lib/css/stacks-static.less +86 -86
  62. package/lib/css/stacks.less +13 -13
  63. package/lib/ts/controllers/index.ts +7 -7
  64. package/lib/ts/controllers/s-expandable-control.ts +188 -188
  65. package/lib/ts/controllers/s-modal.ts +321 -321
  66. package/lib/ts/controllers/s-navigation-tablist.ts +117 -117
  67. package/lib/ts/controllers/s-popover.ts +567 -547
  68. package/lib/ts/controllers/s-table.ts +220 -220
  69. package/lib/ts/controllers/s-tooltip.ts +246 -246
  70. package/lib/ts/controllers/s-uploader.ts +172 -172
  71. package/lib/ts/index.ts +20 -20
  72. package/lib/ts/stacks.ts +88 -88
  73. package/lib/tsconfig.json +13 -13
  74. package/package.json +86 -87
@@ -1,209 +1,254 @@
1
- //
2
- // STACK OVERFLOW
3
- // BADGES
4
- //
5
- // This CSS comes from Stacks, our CSS & Pattern library for rapidly building
6
- // Stack Overflow. For documentation of all these classes and how to contribute,
7
- // visit https://stackoverflow.design/
8
- //
9
- // TABLE OF CONTENTS
10
- // • BASE STYLE
11
- // • STYLE VARIATIONS
12
- // • LAYOUTS & SIZES
13
- //
14
- // ===========================================================================
15
- // $ MIXIN
16
- // Any badge we use will always modify the same items, so to save time,
17
- // here's a mixin to state all that CSS.
18
- // ---------------------------------------------------------------------------
19
- .badge-styles(@border: transparent, @background: transparent, @color: inherit) {
20
- border-color: @border;
21
- background-color: @background;
22
- color: @color;
23
- }
24
-
25
- // ===========================================================================
26
- // $ BASE STYLE
27
- // The same style is applied to all badges. Do not modify the core style.
28
- // ---------------------------------------------------------------------------
29
- .s-badge {
30
- display: inline-flex;
31
- align-items: center;
32
- justify-content: center;
33
- min-width: 0;
34
- padding: 0 var(--su6);
35
- border-width: 1px;
36
- border-style: solid;
37
- border-radius: var(--br-sm);
38
- font-size: var(--fs-caption);
39
- font-weight: normal;
40
- line-height: 2;
41
- text-decoration: none;
42
- vertical-align: middle;
43
- white-space: nowrap;
44
-
45
- .badge-styles(var(--bc-medium), var(--black-050), var(--black-700));
46
-
47
- a&:hover {
48
- text-decoration: none;
49
- }
50
- }
51
-
52
- // $ BADGE IMAGE
53
- // When we have a badge image
54
- // ---------------------------------------------------------------------------
55
- .s-badge--image {
56
- display: inline-flex;
57
- align-self: center;
58
- margin-right: var(--su1);
59
- margin-left: calc((var(--su4) + var(--su1)) * -1);
60
- }
61
-
62
- // $ BADGE SIZES
63
- // ---------------------------------------------------------------------------
64
- .s-badge__sm {
65
- min-width: 18px;
66
- align-self: flex-start;
67
- padding-right: var(--su4);
68
- padding-left: var(--su4);
69
- font-size: var(--fs-fine);
70
- line-height: 1.8;
71
- }
72
-
73
- .s-badge__xs {
74
- align-self: flex-start;
75
- padding-right: var(--su2);
76
- padding-left: var(--su2);
77
- font-size: var(--fs-fine);
78
- line-height: 1.5;
79
- }
80
-
81
- // $$ Badge Counts
82
- // ---------------------------------------------------------------------------
83
- .s-badge__gold {
84
- .badge-styles(var(--gold-darker), var(--gold-lighter), var(--black-700));
85
- }
86
- .s-badge__silver {
87
- .badge-styles(var(--silver-darker), var(--silver-lighter), var(--black-700));
88
- }
89
- .s-badge__bronze {
90
- .badge-styles(var(--bronze-darker), var(--bronze-lighter), var(--black-700));
91
- }
92
- .s-badge__gold,
93
- .s-badge__silver,
94
- .s-badge__bronze {
95
- .highcontrast-mode({
96
- border-color: currentColor;
97
- color: var(--black-900);
98
- });
99
- }
100
-
101
- // $$ Number Counts
102
- // ---------------------------------------------------------------------------
103
- .s-badge__bounty {
104
- .badge-styles(transparent, var(--blue-600), var(--white));
105
- }
106
- .s-badge__votes {
107
- .badge-styles(var(--black-150), var(--white), var(--black-700));
108
-
109
- .highcontrast-mode({ border-color: currentColor; });
110
- }
111
- .s-badge__answered {
112
- .badge-styles(transparent, var(--green-400), var(--white));
113
- }
114
- .s-badge__rep {
115
- .badge-styles(var(--green-400), var(--white), var(--green-500));
116
- .highcontrast-mode({ border-color: currentColor; });
117
- }
118
- .s-badge__rep-down {
119
- .badge-styles(var(--red-400), var(--white), var(--red-500));
120
- .highcontrast-mode({ border-color: currentColor; });
121
- }
122
- .s-badge__important {
123
- .badge-styles(transparent, var(--red-600), var(--white));
124
- }
125
-
126
- // $$ Users
127
- // ---------------------------------------------------------------------------
128
- .s-badge__admin {
129
- .badge-styles(var(--theme-primary-200), var(--theme-primary-075), var(--theme-primary-800));
130
- .highcontrast-mode({ border-color: currentColor; });
131
- }
132
- .s-badge__moderator {
133
- .badge-styles(var(--theme-secondary-200), var(--theme-secondary-075), var(--theme-secondary-800));
134
- .highcontrast-mode({ border-color: currentColor; });
135
-
136
- &:before {
137
- --s-badge-moderator-icon: url("data:image/svg+xml,%3Csvg width='12' height='14' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.528.746c.257-.329.675-.327.93 0l4.42 5.66c.258.329.257.864 0 1.192l-4.42 5.66c-.256.328-.674.327-.93 0l-4.42-5.66c-.257-.329-.256-.865 0-1.192l4.42-5.66z' fill='%23fff'/%3E%3C/svg%3E");
138
-
139
- content: "";
140
- display: inline-block;
141
- background-color: currentColor;
142
- -webkit-mask: var(--s-badge-moderator-icon) no-repeat center;
143
- mask: var(--s-badge-moderator-icon) no-repeat center;
144
- -webkit-mask-size: contain;
145
- mask-size: contain;
146
-
147
- width: 12px;
148
- height: 14px;
149
- margin-top: -1px;
150
- margin-right: 3px;
151
- }
152
-
153
- &.s-badge__sm:before {
154
- --s-badge-moderator-icon: url("data:image/svg+xml,%3Csvg width='9' height='11' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.55.246c.257-.329.647-.327.903 0l3.36 4.66c.256.329.256.864 0 1.192L4.45 10.75c-.257.329-.644.327-.9 0L.192 6.098c-.256-.329-.256-.865 0-1.192L3.55.246z' fill='%23fff'/%3E%3C/svg%3E");
155
-
156
- width: 9px;
157
- height: 11px;
158
- margin-top: 0;
159
- margin-right: 2px;
160
- }
161
-
162
- &.s-badge__xs:before {
163
- --s-badge-moderator-icon: url("data:image/svg+xml,%3Csvg width='7' height='9' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 .246c.3-.329.701-.327 1 0L6.776 4c.3.329.298.672 0 1L4 8.75c-.299.329-.702.327-1 0L.224 5c-.284-.324-.285-.675 0-1L3 .246z' fill='%23fff'/%3E%3C/svg%3E");
164
-
165
- width: 7px;
166
- height: 9px;
167
- margin-top: 0;
168
- }
169
- }
170
-
171
- .s-badge__staff {
172
- // Staff badges are always "Stack Overflow Orange"
173
- .badge-styles(var(--orange-300), var(--orange-100), var(--orange-900));
174
- .highcontrast-mode({ border-color: currentColor; });
175
- }
176
-
177
- // $$ Award Count
178
- // ---------------------------------------------------------------------------
179
- .s-award-bling {
180
- display: flex;
181
- align-items: center;
182
- color: inherit;
183
-
184
- &:before {
185
- content: "";
186
- margin-right: 4px;
187
- width: 8px;
188
- height: 8px;
189
- border-radius: 100%;
190
- }
191
-
192
- &.s-award-bling__gold {
193
- &:before {
194
- background-color: var(--gold);
195
- }
196
- }
197
-
198
- &.s-award-bling__silver {
199
- &:before {
200
- background-color: var(--silver);
201
- }
202
- }
203
-
204
- &.s-award-bling__bronze {
205
- &:before {
206
- background-color: var(--bronze);
207
- }
208
- }
209
- }
1
+ //
2
+ // STACK OVERFLOW
3
+ // BADGES
4
+ //
5
+ // This CSS comes from Stacks, our CSS & Pattern library for rapidly building
6
+ // Stack Overflow. For documentation of all these classes and how to contribute,
7
+ // visit https://stackoverflow.design/
8
+ //
9
+ // TABLE OF CONTENTS
10
+ // • BASE STYLE
11
+ // • STYLE VARIATIONS
12
+ // • LAYOUTS & SIZES
13
+ //
14
+ // ===========================================================================
15
+ // $ MIXIN
16
+ // Any badge we use will always modify the same items, so to save time,
17
+ // here's a mixin to state all that CSS.
18
+ // ---------------------------------------------------------------------------
19
+ .badge-styles(@border: transparent, @background: transparent, @color: inherit) {
20
+ border-color: @border;
21
+ background-color: @background;
22
+ color: @color;
23
+ }
24
+
25
+ // ===========================================================================
26
+ // $ BASE STYLE
27
+ // The same style is applied to all badges. Do not modify the core style.
28
+ // ---------------------------------------------------------------------------
29
+ .s-badge {
30
+ display: inline-flex;
31
+ align-items: center;
32
+ justify-content: center;
33
+ min-width: 0;
34
+ padding: 0 var(--su6);
35
+ border-width: 1px;
36
+ border-style: solid;
37
+ border-radius: var(--br-sm);
38
+ font-size: var(--fs-caption);
39
+ font-weight: normal;
40
+ line-height: 2;
41
+ text-decoration: none;
42
+ vertical-align: middle;
43
+ white-space: nowrap;
44
+
45
+ .badge-styles(var(--bc-medium), var(--black-050), var(--black-700));
46
+
47
+ a&:hover {
48
+ text-decoration: none;
49
+ }
50
+ }
51
+
52
+ // $ BADGE IMAGE
53
+ // When we have a badge image
54
+ // ---------------------------------------------------------------------------
55
+ .s-badge--image {
56
+ display: inline-flex;
57
+ align-self: center;
58
+ margin-right: var(--su1);
59
+ margin-left: calc((var(--su4) + var(--su1)) * -1);
60
+ }
61
+
62
+ // $ BADGE ICON
63
+ // When we have a badge icon
64
+ // ---------------------------------------------------------------------------
65
+ .s-badge__icon {
66
+ gap: 0.3em;
67
+ }
68
+
69
+ // $ BADGE SIZES
70
+ // ---------------------------------------------------------------------------
71
+ .s-badge__sm {
72
+ min-width: 18px;
73
+ align-self: flex-start;
74
+ padding-right: var(--su4);
75
+ padding-left: var(--su4);
76
+ font-size: var(--fs-fine);
77
+ line-height: 1.8;
78
+ }
79
+
80
+ .s-badge__xs {
81
+ align-self: flex-start;
82
+ padding-right: var(--su2);
83
+ padding-left: var(--su2);
84
+ font-size: var(--fs-fine);
85
+ line-height: 1.5;
86
+ }
87
+
88
+ // $$ Badge Counts
89
+ // ---------------------------------------------------------------------------
90
+ .s-badge__gold {
91
+ .badge-styles(var(--gold-darker), var(--gold-lighter), var(--black-700));
92
+ }
93
+ .s-badge__silver {
94
+ .badge-styles(var(--silver-darker), var(--silver-lighter), var(--black-700));
95
+ }
96
+ .s-badge__bronze {
97
+ .badge-styles(var(--bronze-darker), var(--bronze-lighter), var(--black-700));
98
+ }
99
+ .s-badge__gold,
100
+ .s-badge__silver,
101
+ .s-badge__bronze {
102
+ .highcontrast-mode({
103
+ border-color: currentColor;
104
+ color: var(--black-900);
105
+ });
106
+ }
107
+
108
+ // $$ Number Counts
109
+ // ---------------------------------------------------------------------------
110
+ .s-badge__bounty {
111
+ .badge-styles(transparent, var(--blue-600), var(--white));
112
+ }
113
+ .s-badge__votes {
114
+ .badge-styles(var(--black-150), var(--white), var(--black-700));
115
+
116
+ .highcontrast-mode({ border-color: currentColor; });
117
+ }
118
+ .s-badge__answered {
119
+ .badge-styles(transparent, var(--green-400), var(--white));
120
+ }
121
+ .s-badge__rep {
122
+ .badge-styles(var(--green-400), var(--white), var(--green-500));
123
+ .highcontrast-mode({ border-color: currentColor; });
124
+ }
125
+ .s-badge__rep-down {
126
+ .badge-styles(var(--red-400), var(--white), var(--red-500));
127
+ .highcontrast-mode({ border-color: currentColor; });
128
+ }
129
+ .s-badge__important {
130
+ .badge-styles(transparent, var(--red-600), var(--white));
131
+ }
132
+
133
+ // $$ Users
134
+ // ---------------------------------------------------------------------------
135
+ .s-badge__admin {
136
+ .badge-styles(var(--theme-primary-200), var(--theme-primary-075), var(--theme-primary-800));
137
+ .highcontrast-mode({ border-color: currentColor; });
138
+ }
139
+ .s-badge__moderator {
140
+ .badge-styles(var(--theme-secondary-200), var(--theme-secondary-075), var(--theme-secondary-800));
141
+ .highcontrast-mode({ border-color: currentColor; });
142
+
143
+ &:before {
144
+ --s-badge-moderator-icon: url("data:image/svg+xml,%3Csvg width='12' height='14' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.528.746c.257-.329.675-.327.93 0l4.42 5.66c.258.329.257.864 0 1.192l-4.42 5.66c-.256.328-.674.327-.93 0l-4.42-5.66c-.257-.329-.256-.865 0-1.192l4.42-5.66z' fill='%23fff'/%3E%3C/svg%3E");
145
+
146
+ content: "";
147
+ display: inline-block;
148
+ background-color: currentColor;
149
+ -webkit-mask: var(--s-badge-moderator-icon) no-repeat center;
150
+ mask: var(--s-badge-moderator-icon) no-repeat center;
151
+ -webkit-mask-size: contain;
152
+ mask-size: contain;
153
+
154
+ width: 12px;
155
+ height: 14px;
156
+ margin-top: -1px;
157
+ margin-right: 3px;
158
+ }
159
+
160
+ &.s-badge__sm:before {
161
+ --s-badge-moderator-icon: url("data:image/svg+xml,%3Csvg width='9' height='11' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.55.246c.257-.329.647-.327.903 0l3.36 4.66c.256.329.256.864 0 1.192L4.45 10.75c-.257.329-.644.327-.9 0L.192 6.098c-.256-.329-.256-.865 0-1.192L3.55.246z' fill='%23fff'/%3E%3C/svg%3E");
162
+
163
+ width: 9px;
164
+ height: 11px;
165
+ margin-top: 0;
166
+ margin-right: 2px;
167
+ }
168
+
169
+ &.s-badge__xs:before {
170
+ --s-badge-moderator-icon: url("data:image/svg+xml,%3Csvg width='7' height='9' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 .246c.3-.329.701-.327 1 0L6.776 4c.3.329.298.672 0 1L4 8.75c-.299.329-.702.327-1 0L.224 5c-.284-.324-.285-.675 0-1L3 .246z' fill='%23fff'/%3E%3C/svg%3E");
171
+
172
+ width: 7px;
173
+ height: 9px;
174
+ margin-top: 0;
175
+ }
176
+ }
177
+
178
+ .s-badge__staff {
179
+ // Staff badges are always "Stack Overflow Orange"
180
+ .badge-styles(var(--orange-300), var(--orange-100), var(--orange-900));
181
+ .highcontrast-mode({ border-color: currentColor; });
182
+ }
183
+
184
+ // $$ States
185
+ // ---------------------------------------------------------------------------
186
+ &.s-badge__danger {
187
+ color: var(--red-900);
188
+ background-color: var(--red-100);
189
+ border-color: var(--red-600);
190
+
191
+ &.s-badge__filled {
192
+ color: @white;
193
+ background-color: var(--red-500);
194
+ border-color: transparent;
195
+ }
196
+ }
197
+
198
+ &.s-badge__info {
199
+ color: var(--blue-900);
200
+ background-color: var(--blue-100);
201
+ border-color: var(--blue-600);
202
+ }
203
+
204
+ &.s-badge__warning {
205
+ color: var(--yellow-900);
206
+ background-color: var(--yellow-100);
207
+ border-color: var(--yellow-600);
208
+ }
209
+
210
+ &.s-badge__muted {
211
+ color: var(--black-900);
212
+ background-color: var(--black-100);
213
+ border-color: var(--black-600);
214
+
215
+ &.s-badge__filled {
216
+ color: var(--white);
217
+ background-color: var(--black-700);
218
+ border-color: transparent;
219
+ }
220
+ }
221
+
222
+ // $$ Award Count
223
+ // ---------------------------------------------------------------------------
224
+ .s-award-bling {
225
+ display: flex;
226
+ align-items: center;
227
+ color: inherit;
228
+
229
+ &:before {
230
+ content: "";
231
+ margin-right: 4px;
232
+ width: 8px;
233
+ height: 8px;
234
+ border-radius: 100%;
235
+ }
236
+
237
+ &.s-award-bling__gold {
238
+ &:before {
239
+ background-color: var(--gold);
240
+ }
241
+ }
242
+
243
+ &.s-award-bling__silver {
244
+ &:before {
245
+ background-color: var(--silver);
246
+ }
247
+ }
248
+
249
+ &.s-award-bling__bronze {
250
+ &:before {
251
+ background-color: var(--bronze);
252
+ }
253
+ }
254
+ }
@@ -1,80 +1,80 @@
1
- //
2
- // STACK OVERFLOW
3
- // BANNERS
4
- //
5
- // This CSS comes from Stacks, our CSS & Pattern library for rapidly building
6
- // Stack Overflow. For documentation of all these classes and how to contribute,
7
- // visit https://stackoverflow.design/
8
- //
9
- // TABLE OF CONTENTS
10
- // • SYSTEM BANNERS
11
- //
12
- // ============================================================================
13
- // When we use .s-banner, we need to adjust the padding-top on
14
- // the body tag. This class correctly adjusts the body padding ONLY if
15
- // the notice is one line. If it wraps to multiple lines, more classes or
16
- // (ideally) JS will need to be used to determine the notice's height
17
- // at the time of render. The padding value is determined like so:
18
- //
19
- // 50px (top bar) + 44px (notice height) - 1px (bottom border)
20
- //
21
- // The borders subtraction are necessary to neatly tuck everything together.
22
- // ----------------------------------------------------------------------------
23
- .s-banner__body-pt {
24
- padding-top: 93px;
25
- }
26
-
27
- // ============================================================================
28
- // $ SYSTEM BANNERS
29
- // ----------------------------------------------------------------------------
30
- .s-banner {
31
- position: fixed;
32
- z-index: calc(var(--zi-navigation-fixed) - 1); // Tuck below topbar
33
- top: 0;
34
- right: 0;
35
- left: 0;
36
- width: 100%;
37
- padding: var(--su12);
38
- border-top: 1px solid transparent;
39
- border-bottom: 1px solid transparent;
40
- border-radius: 0;
41
- box-shadow: none;
42
- color: var(--fc-medium);
43
- font-size: var(--fs-body1);
44
-
45
- // If you want to hide and reveal the banner
46
- &[aria-hidden="true"] {
47
- visibility: hidden;
48
- opacity: 0;
49
- -webkit-transform: translate3d(0, -50px, 0);
50
- transform: translate3d(0, -50px, 0);
51
- }
52
-
53
- &[aria-hidden="false"] {
54
- visibility: visible;
55
- opacity: 1;
56
- -webkit-transform: translate3d(0, 49px, 0);
57
- transform: translate3d(0, 49px, 0);
58
- }
59
-
60
- // If you want to put the banner above the topbar
61
- &.is-pinned {
62
- z-index: calc(var(--zi-navigation-fixed) + 1);
63
- -webkit-transform: translate3d(0, 0, 0);
64
- transform: translate3d(0, 0, 0);
65
- }
66
-
67
- // If it's a really important banner
68
- &.s-banner__important {
69
- border-color: transparent;
70
- color: var(--white);
71
- }
72
- }
73
-
74
- // -- When we want to keep hero content capped
75
- .s-banner--container {
76
- position: relative;
77
- width: 100%;
78
- max-width: calc(var(--s-step) * 10);
79
- margin: 0 auto;
80
- }
1
+ //
2
+ // STACK OVERFLOW
3
+ // BANNERS
4
+ //
5
+ // This CSS comes from Stacks, our CSS & Pattern library for rapidly building
6
+ // Stack Overflow. For documentation of all these classes and how to contribute,
7
+ // visit https://stackoverflow.design/
8
+ //
9
+ // TABLE OF CONTENTS
10
+ // • SYSTEM BANNERS
11
+ //
12
+ // ============================================================================
13
+ // When we use .s-banner, we need to adjust the padding-top on
14
+ // the body tag. This class correctly adjusts the body padding ONLY if
15
+ // the notice is one line. If it wraps to multiple lines, more classes or
16
+ // (ideally) JS will need to be used to determine the notice's height
17
+ // at the time of render. The padding value is determined like so:
18
+ //
19
+ // 50px (top bar) + 44px (notice height) - 1px (bottom border)
20
+ //
21
+ // The borders subtraction are necessary to neatly tuck everything together.
22
+ // ----------------------------------------------------------------------------
23
+ .s-banner__body-pt {
24
+ padding-top: 93px;
25
+ }
26
+
27
+ // ============================================================================
28
+ // $ SYSTEM BANNERS
29
+ // ----------------------------------------------------------------------------
30
+ .s-banner {
31
+ position: fixed;
32
+ z-index: calc(var(--zi-navigation-fixed) - 1); // Tuck below topbar
33
+ top: 0;
34
+ right: 0;
35
+ left: 0;
36
+ width: 100%;
37
+ padding: var(--su12);
38
+ border-top: 1px solid transparent;
39
+ border-bottom: 1px solid transparent;
40
+ border-radius: 0;
41
+ box-shadow: none;
42
+ color: var(--fc-medium);
43
+ font-size: var(--fs-body1);
44
+
45
+ // If you want to hide and reveal the banner
46
+ &[aria-hidden="true"] {
47
+ visibility: hidden;
48
+ opacity: 0;
49
+ -webkit-transform: translate3d(0, -50px, 0);
50
+ transform: translate3d(0, -50px, 0);
51
+ }
52
+
53
+ &[aria-hidden="false"] {
54
+ visibility: visible;
55
+ opacity: 1;
56
+ -webkit-transform: translate3d(0, 49px, 0);
57
+ transform: translate3d(0, 49px, 0);
58
+ }
59
+
60
+ // If you want to put the banner above the topbar
61
+ &.is-pinned {
62
+ z-index: calc(var(--zi-navigation-fixed) + 1);
63
+ -webkit-transform: translate3d(0, 0, 0);
64
+ transform: translate3d(0, 0, 0);
65
+ }
66
+
67
+ // If it's a really important banner
68
+ &.s-banner__important {
69
+ border-color: transparent;
70
+ color: var(--white);
71
+ }
72
+ }
73
+
74
+ // -- When we want to keep hero content capped
75
+ .s-banner--container {
76
+ position: relative;
77
+ width: 100%;
78
+ max-width: calc(var(--s-step) * 10);
79
+ margin: 0 auto;
80
+ }