Skip to content

Commit b28c3e0

Browse files
authored
Fix staging-ribbon style on dartdoc pages. (#8234)
1 parent c178be3 commit b28c3e0

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

app/lib/dartdoc/dartdoc_page.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,11 @@ extension DartDocPageRender on DartDocPage {
285285
final dataBaseHref = p.relative('', from: p.dirname(options.path));
286286
return d.element('body', classes: [
287287
'light-theme',
288-
if (activeConfiguration.isStaging) 'staging-banner',
289288
], attributes: {
290289
'data-base-href':
291290
baseHref ?? (dataBaseHref == '.' ? '' : '$dataBaseHref/'),
292291
'data-using-base-href': usingBaseHref ?? 'false',
292+
if (activeConfiguration.isStaging) 'data-staging': '1',
293293
}, children: [
294294
if (activeConfiguration.isStaging)
295295
d.div(classes: ['staging-ribbon'], text: 'staging'),

app/lib/frontend/templates/views/shared/layout.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,10 @@ d.Node pageLayoutNode({
166166
requestContext.experimentalFlags.isDarkModeDefault
167167
? 'dark-theme'
168168
: 'light-theme',
169-
if (activeConfiguration.isStaging) 'staging-banner',
170169
],
170+
attributes: {
171+
if (activeConfiguration.isStaging) 'data-staging': '1',
172+
},
171173
children: [
172174
// The initialization of dark theme must be in a synchronous, blocking
173175
// script execution, as otherwise users may see flash of unstyled content

pkg/web_css/lib/dartdoc.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
@use '../../../third_party/dartdoc/resources/github.css';
1313
@use '../../../third_party/dartdoc/resources/styles.css';
1414

15-
@import 'src/_staging_ribbon.scss';
15+
@use 'src/_staging_ribbon.scss';
1616

1717
// This is meant for a temporary override for highlight.js. We need to
1818
// figure out a better way to customize the syntax highlights for dark

pkg/web_css/lib/src/_staging_ribbon.scss

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
for details. All rights reserved. Use of this source code is governed by a
33
BSD-style license that can be found in the LICENSE file. */
44

5-
body.staging-banner {
6-
border: 4px solid red;
7-
}
8-
9-
body.staging-banner .staging-ribbon {
5+
body[data-staging] {
6+
border: 4px solid red;
7+
8+
.staging-ribbon {
109
position: fixed;
1110
top: 35px;
1211
right: -35px;
@@ -23,4 +22,4 @@
2322
opacity: 0.8;
2423
pointer-events: none;
2524
}
26-
25+
}

0 commit comments

Comments
 (0)