Skip to content

Commit d34e087

Browse files
authored
Fix notification bar link spacing (#1040)
2 parents b4f1898 + 51cf2e3 commit d34e087

File tree

4 files changed

+21
-12
lines changed

4 files changed

+21
-12
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1+
# HEAD
2+
3+
## Bug Fixes
4+
5+
* **css:** Notification bar padding of links only working for complete sentences (#1000)
6+
* **css:** Missing explicit `mzp-c-notification-bar-cta` distinction (#1041)
7+
18
# 20.0.0
29

310
## Features
11+
412
* **fonts:** (breaking) Adds rebrand fonts, Mozilla Headline and Mozilla Text. Removes outdated Mozilla Brand font, Zilla Slab. New fonts will only support `woff2` format to simplify maintenance.
513
* **fonts:** Upgrade Inter font to version 4.1, drop WOFF 1.0 format (#1026)
614
* **css:** Add `text-wrap: balance` to all headings (#910)
715
* **css:** Apply hover cursor from Details component to Details element (#948)
816
* **assets:** Update @mozilla-protocol/assets to 5.4.0
917

1018
## Migration Tips
19+
1120
* **fonts:** Any use of `font-mozilla` mixin should be replaced with `font-mozilla-headline`. NOTE: we recommend `font-mozilla-headline` only for text over 24px (below should be `font-mozilla-text`)
1221
* Headings are now [balanced](https://developer.mozilla.org/docs/Web/CSS/text-wrap-style#balanced_text), which can impact other wrapping rules. Make sure any changes to `h1``h6` rendering end up styled as expected, especially if you apply any `white-space`, `word-break` or `hyphens` customizations.
1322
* See notes for [Protocol Assets 5.4.0](https://github.com/mozilla/protocol-assets/blob/main/CHANGELOG.md#540)

assets/js/protocol/notification-bar.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,17 @@ MzpNotification.init = (origin, opts) => {
3636
const className = (options && options.className) ? options.className : '';
3737
const closeText = (options && options.closeText) ? options.closeText : '';
3838
const isSticky = (options && options.isSticky) ? 'mzp-is-sticky' : '';
39-
const ctaOptions = options && options.cta ? options.cta : {};
39+
const ctaOptions = (options && options.cta) ? options.cta : {};
4040

4141
const notification = document.createElement('aside');
4242
notification.className = 'mzp-c-notification-bar ' + className + ' ' + isSticky;
4343

44-
// Notification Title
45-
46-
if (options && options.title){
44+
const notificationContent = document.createElement('p');
45+
notification.appendChild(notificationContent);
4746

48-
const notificationTitle = document.createElement('p');
49-
notificationTitle.appendChild(title);
50-
51-
// add title to notification
52-
notification.appendChild(notificationTitle);
47+
// Notification Title
48+
if (options && options.title) {
49+
notificationContent.appendChild(title);
5350
}
5451

5552
// Notification CTA link
@@ -67,7 +64,7 @@ MzpNotification.init = (origin, opts) => {
6764
for (key in ctaAttrs){
6865
ctaAnchor.setAttribute(key, ctaAttrs[key]);
6966
}
70-
notification.appendChild(ctaAnchor);
67+
notificationContent.appendChild(ctaAnchor);
7168
}
7269

7370
// Notification Fragment

assets/sass/protocol/components/_notification-bar.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,17 @@
3535
display: inline-block;
3636
font-size: inherit;
3737
font-weight: 700;
38-
margin: 0 $spacing-sm;
3938

4039
&:hover,
4140
&:active,
4241
&:focus {
4342
color: inherit;
4443
text-decoration: none;
4544
}
45+
46+
&.mzp-c-notification-bar-cta {
47+
margin: 0 $spacing-sm;
48+
}
4649
}
4750

4851
&.mzp-is-sticky {

components/notification-bar/notification-bar.config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ variants:
1919
context:
2020
class: mzp-t-warning
2121
close_button: True
22-
content: Warning! It's dangerous to go alone.
22+
content: Warning! It’s <a href="#">dangerous</a> to go alone.
2323
- name: Error
2424
notes: Use the class `mzp-t-error` for a negative notification, to indicate
2525
an unsuccessful action. This example also features an action link.

0 commit comments

Comments
 (0)