Skip to content

Commit ee20047

Browse files
committed
fix(launch): add inline notification styles for noscript users
1 parent 48dcdd7 commit ee20047

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed

docs/docs/presets/launch.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ The launch preset configures [11ty data](https://www.11ty.dev/docs/data/) using
5858
import '@rocket/launch/inline-notification/inline-notification.js';
5959
```
6060

61-
Launch ships with `<inline-notification>`, a custom element that applies some styles similar to "info boxes".
61+
Launch ships with `<inline-notification>`, a custom element that applies some styles similar to "info boxes". The element works for `<noscript>` users as well, as long as you don't [override](/guides/presets/override/) the default `noscript.css` file.
6262

6363
To add an inline notification you need to remember to import the element definition:
6464

@@ -134,3 +134,9 @@ I am a success message
134134

135135
</inline-notification>
136136
```
137+
138+
<inline-notification type="warning">
139+
140+
The `title` attribute does not change the title for `<noscript>` users, so don't include any critical information in it.
141+
142+
</inline-notification>

packages/launch/preset/_assets/_static/noscript.css

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,53 @@
44
:not(:defined) {
55
opacity: 1 !important;
66
}
7+
8+
inline-notification {
9+
padding: 0.1rem 1.5rem;
10+
border-left-width: 0.5rem;
11+
border-left-style: solid;
12+
margin: 1rem 0;
13+
display: block;
14+
opacity: 1 !important;
15+
}
16+
17+
inline-notification::before {
18+
content: attr(type);
19+
font-weight: 600;
20+
font-size: 1.17em;
21+
margin-top: 24px;
22+
margin-bottom: 7px;
23+
display: block;
24+
text-transform: uppercase;
25+
}
26+
27+
inline-notification[type='tip'] {
28+
background-color: var(--inline-notification-tip-background-color, rgba(221, 221, 221, 0.3));
29+
border-color: var(--inline-notification-tip-border-color, #42b983);
30+
}
31+
32+
inline-notification[type='warning'] {
33+
background-color:
34+
var(
35+
--inline-notification-warning-background-color,
36+
rgba(255, 229, 100, 0.2)
37+
);
38+
border-color: var(--inline-notification-warning-border-color, #e7c000);
39+
}
40+
41+
inline-notification[type='danger'] {
42+
background-color: var(--inline-notification-danger-background-color, rgba(192, 0, 0, 0.1));
43+
border-color: var(--inline-notification-danger-border-color, #c00);
44+
}
45+
46+
inline-notification[type='warning']::before {
47+
color: var(--inline-notification-warning-heading-color, #b29400);
48+
}
49+
50+
inline-notification[type='danger']::before {
51+
color: var(--inline-notification-danger-heading-color, #900);
52+
}
53+
54+
inline-notification > p {
55+
line-height: 1.7;
56+
}

0 commit comments

Comments
 (0)