diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fe42c82a..3d1293195 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## HEAD -* **css:** Rename `mzp-c-box-emphasis` to `mzp-c-emphasis-box` (#489) +* **css:** Add Zap component (#511) +* **css:** (breaking) Rename `mzp-c-box-emphasis` to `mzp-c-emphasis-box` (#489) * **assets:** Update @mozilla-protocol/assets to 3.0.1 (#509) * **css:** CTA links now use text underlines instead of borders (#490) diff --git a/src/assets/sass/protocol/components/_zap.scss b/src/assets/sass/protocol/components/_zap.scss new file mode 100644 index 000000000..5fb56e6f3 --- /dev/null +++ b/src/assets/sass/protocol/components/_zap.scss @@ -0,0 +1,24 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + + +@import '../protocol/includes/lib'; + +[class*="mzp-has-zap"] strong { + @include zap('#{$image-path}/zaps/zap-01.svg'); +} + +@for $num from 2 through 18 { + .mzp-has-zap-#{$num} strong { + // add leading zero if necessary + $zero: ''; + @if $num < 10 { + $zero: 0; + } + + &::after { + background-image: url('#{$image-path}/zaps/zap-#{$zero}#{$num}.svg'); + } + } +} diff --git a/src/assets/sass/protocol/includes/_mixins.scss b/src/assets/sass/protocol/includes/_mixins.scss index 7899a34c7..a16390fa0 100644 --- a/src/assets/sass/protocol/includes/_mixins.scss +++ b/src/assets/sass/protocol/includes/_mixins.scss @@ -8,6 +8,7 @@ 'mixins/grid', 'mixins/images', 'mixins/bidi', + 'mixins/zap', 'mixins/typography'; diff --git a/src/assets/sass/protocol/includes/mixins/_zap.scss b/src/assets/sass/protocol/includes/mixins/_zap.scss new file mode 100644 index 000000000..9b13b4348 --- /dev/null +++ b/src/assets/sass/protocol/includes/mixins/_zap.scss @@ -0,0 +1,23 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +/* -------------------------------------------------------------------------- */ +// Zap + +@mixin zap($img) { + position: relative; + + &:after { + background-image: url('#{$img}'); + background-repeat: no-repeat; + background-size: 100% 100%; + content: ''; + display: block; + height: 0.3em; + left: -0.2em; + position: absolute; + top: calc(100% - 0.15em); + width: calc(100% + 0.4em); + } +} diff --git a/src/assets/sass/protocol/protocol-extra.scss b/src/assets/sass/protocol/protocol-extra.scss index 8f94999b3..7b25f944e 100644 --- a/src/assets/sass/protocol/protocol-extra.scss +++ b/src/assets/sass/protocol/protocol-extra.scss @@ -21,5 +21,6 @@ $image-path: '../img' !default; @import '../protocol/components/notification-bar'; @import '../protocol/components/picto-card'; @import '../protocol/components/sidebar-menu'; +@import '../protocol/components/zap'; @import '../protocol/templates/card-layout'; @import '../protocol/templates/main-with-sidebar'; diff --git a/src/pages/demos/zap.hbs b/src/pages/demos/zap.hbs new file mode 100644 index 000000000..e293b8dd2 --- /dev/null +++ b/src/pages/demos/zap.hbs @@ -0,0 +1,23 @@ +--- +title: Zap Styles +notes: All 18 zap styles +--- + +