Skip to content

Commit 0e703ea

Browse files
wip: add alert of type warning
Co-authored-by: David Larlet <[email protected]>
1 parent 5c846f9 commit 0e703ea

File tree

3 files changed

+69
-30
lines changed

3 files changed

+69
-30
lines changed

umap/static/umap/js/components/alerts/alert.css

Lines changed: 62 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
.umap-alert[role="dialog"] {
22
box-sizing: border-box;
3-
min-height: 46px;
4-
line-height: 46px;
53
padding: var(--box-padding);
64
position: absolute;
75
box-shadow: 0 1px 7px #999999;
@@ -20,60 +18,81 @@
2018
width: max-content;
2119
z-index: var(--zindex-alert);
2220
}
23-
.umap-alert[role="dialog"] > div {
21+
22+
.umap-alert[role="dialog"]>div {
2423
margin: 0 auto;
2524
min-width: 60%;
2625
background-size: 20px;
27-
background-position: 0 15px;
2826
padding-inline-start: 28px;
27+
background-position: 0 center;
28+
min-height: 10vh;
29+
display: flex;
30+
flex-direction: column;
31+
justify-content: center;
2932
}
30-
.umap-alert[role="dialog"][data-level="info"] > div {
33+
34+
.umap-alert[role="dialog"][data-level="info"]>div {
3135
background-image: url('../../../img/alert-icon-info.svg');
3236
background-repeat: no-repeat;
3337
}
34-
html[dir="rtl"] .umap-alert[role="dialog"][data-level="info"] > div {
35-
background-position: right;
36-
}
37-
.umap-alert[role="dialog"][data-level="success"] > div {
38+
39+
.umap-alert[role="dialog"][data-level="success"]>div {
3840
background-image: url('../../../img/alert-icon-success.svg');
3941
background-repeat: no-repeat;
4042
}
41-
html[dir="rtl"] .umap-alert[role="dialog"][data-level="success"] > div {
42-
background-position: right;
43-
}
44-
.umap-alert[role="dialog"][data-level="error"] > div {
43+
44+
.umap-alert[role="dialog"][data-level="warning"]>div,
45+
.umap-alert[role="dialog"][data-level="error"]>div {
4546
background-image: url('../../../img/alert-icon-error.svg');
4647
background-repeat: no-repeat;
4748
}
48-
html[dir="rtl"] .umap-alert[role="dialog"][data-level="error"] > div {
49+
50+
html[dir="rtl"] .umap-alert[role="dialog"][data-level="info"]>div,
51+
html[dir="rtl"] .umap-alert[role="dialog"][data-level="success"]>div,
52+
html[dir="rtl"] .umap-alert[role="dialog"][data-level="warning"]>div,
53+
html[dir="rtl"] .umap-alert[role="dialog"][data-level="error"]>div {
4954
background-position: right;
5055
}
56+
57+
58+
.umap-alert[role="dialog"][data-level="warning"],
5159
.umap-alert[role="dialog"][data-level="error"] {
5260
background-color: var(--color-darkRed);
5361
}
62+
63+
.umap-alert[role="dialog"][data-level="warning"] {
64+
background-color: var(--color-darkOrange);
65+
}
66+
5467
.umap-alert[role="dialog"] a {
5568
text-decoration: underline;
5669
}
70+
5771
.umap-alert[role="dialog"] label {
5872
font-size: .8rem;
5973
font-weight: normal;
6074
}
75+
6176
.umap-alert[role="dialog"] a[target="_blank"] {
6277
background: url('../../../img/icon-external-link.svg') no-repeat right center;
6378
padding-inline-end: 14px;
6479
background-size: 12px;
6580
}
81+
6682
html[dir="rtl"] .umap-alert[role="dialog"] a[target="_blank"] {
6783
background: url('../../../img/icon-external-link.svg') no-repeat left center;
6884
}
85+
6986
h3[role="alert"] {
7087
margin-bottom: 0;
7188
margin-top: 1rem;
7289
line-height: initial;
7390
}
74-
h3[role="alert"] + p {
91+
92+
h3[role="alert"]+p {
7593
margin-top: 0;
7694
}
95+
7796
[role="group"] {
7897
display: inline-flex;
7998
position: relative;
@@ -84,61 +103,70 @@ h3[role="alert"] + p {
84103
padding: 0;
85104
border: none;
86105
}
106+
87107
[role="group"] input:not([type="checkbox"], [type="radio"]):not(:last-child),
88-
[role="group"] > :not(:last-child) {
89-
border-start-end-radius: 0;
90-
border-end-end-radius: 0;
108+
[role="group"]> :not(:last-child) {
109+
border-start-end-radius: 0;
110+
border-end-end-radius: 0;
91111
}
112+
92113
[role="group"] input:not([type="checkbox"], [type="radio"]):not(:first-child),
93-
[role="group"] > :not(:first-child) {
94-
margin-inline-start: 0;
95-
border-start-start-radius: 0;
96-
border-end-start-radius: 0;
97-
width: 45%;
114+
[role="group"]> :not(:first-child) {
115+
margin-inline-start: 0;
116+
border-start-start-radius: 0;
117+
border-end-start-radius: 0;
118+
width: 45%;
98119
}
120+
99121
[role="group"] input[type="submit"] {
100122
background: var(--color-darkGray);
101123
color: var(--color-light);
102124
border: 1px solid var(--color-light);
103125
line-height: initial;
104126
}
127+
105128
[role="group"] input:not([type="submit"]) {
106129
background: var(--color-light);
107130
color: var(--color-darkGray);
108131
border: 1px solid var(--color-light);
109132
}
133+
110134
[role="group"] input[type="button"] {
111135
background: var(--color-darkGray);
112136
color: var(--color-light);
113-
border: none;
114137
line-height: initial;
115138
}
139+
116140
[role="group"] input[type="button"]:hover {
117141
text-decoration: underline;
118-
border: none;
119142
}
143+
120144
@media only screen and (max-width:770px) {
121145
[role="group"] {
122146
display: flex;
123147
flex-direction: column;
124148
}
149+
125150
[role="group"] input:not([type="checkbox"], [type="radio"]):not(:last-child),
126-
[role="group"] > :not(:last-child) {
127-
border-radius: var(--border-radius);
151+
[role="group"]> :not(:last-child) {
152+
border-radius: var(--border-radius);
128153
}
154+
129155
[role="group"] input:not([type="checkbox"], [type="radio"]):not(:first-child),
130-
[role="group"] > :not(:first-child) {
131-
border-radius: var(--border-radius);
156+
[role="group"]> :not(:first-child) {
157+
border-radius: var(--border-radius);
132158
}
133159

134160
[role="group"] input:not([type="checkbox"], [type="radio"]):not(:first-child),
135-
[role="group"] > :not(:first-child) {
161+
[role="group"]> :not(:first-child) {
136162
width: 100%;
137163
}
138164
}
165+
139166
#link-wrapper {
140167
margin-bottom: 1rem;
141168
}
169+
142170
.umap-alert[role="dialog"] #conflict-wrapper a[target="_blank"] {
143171
background-position-y: 16px;
144172
}
@@ -147,25 +175,29 @@ h3[role="alert"] + p {
147175
display: flex;
148176
justify-content: space-around;
149177
}
178+
150179
#conflict-wrapper form [type="submit"] {
151180
width: initial;
152181
background: inherit;
153182
color: var(--color-light);
154183
border: 1px solid var(--color-light);
155184
font-weight: bold;
156185
}
186+
157187
#conflict-wrapper form [type="submit"]:hover {
158188
width: initial;
159189
background: darkred;
160190
color: var(--color-light);
161191
border: 1px solid var(--color-light);
162192
}
193+
163194
@media only screen and (max-width:770px) {
164195
#conflict-wrapper form {
165196
flex-direction: column;
166197
text-align: center;
167198
}
168199
}
200+
169201
umap-alert-choice a {
170202
color: var(--color-light);
171203
text-decoration: underline;

umap/static/umap/js/components/alerts/alert.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ class uMapAlert extends uMapElement {
2222
uMapAlert.emit('alert', { level: 'success', message, duration })
2323
}
2424

25+
// biome-ignore lint/style/useNumberNamespace: Number.Infinity returns undefined by default
26+
static warning(message, duration = Infinity) {
27+
uMapAlert.emit('alert', { level: 'warning', message, duration })
28+
}
29+
2530
// biome-ignore lint/style/useNumberNamespace: Number.Infinity returns undefined by default
2631
static error(message, duration = Infinity) {
2732
uMapAlert.emit('alert', { level: 'error', message, duration })

umap/static/umap/vars.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
--color-darkCyan: #009099;
1717
--color-veryDarkCyan: #046460;
1818
--color-red: #c60f13;
19+
--color-darkOrange: #b36200;
1920
--color-darkRed: #5b2a2a;
2021

2122
--background-color: var(--color-light);
@@ -65,6 +66,7 @@
6566

6667
--block-shadow: 0 1px 7px var(--color-mediumGray);
6768
}
69+
6870
.dark {
6971
--background-color: var(--color-darkGray);
7072
--text-color: #efefef;

0 commit comments

Comments
 (0)