Skip to content

Commit

Permalink
Add centering classes for Logo and Wordmark [fix #718] (#819)
Browse files Browse the repository at this point in the history
  • Loading branch information
craigcook authored Jul 26, 2022
1 parent 80c39a6 commit 866628a
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# HEAD

## Features
* **component:** Add centering classes for Logo and Wordmark. (#718)
* **docs:** Migrate Protocol documentation site to Fractal.
* **node:** Create a Webpack config for compiling docs using Fractal.

Expand Down
18 changes: 18 additions & 0 deletions assets/sass/protocol/components/logos/_logo.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,24 @@ $logo-sizes: (
margin-bottom: $layout-lg;
width: $layout-xl;
}

&.mzp-l-logo-center {
background-position: center top;
margin-left: auto;
margin-right: auto;
}

&.mzp-l-logo-center-on-sm-md {
background-position: center top;
margin-left: auto;
margin-right: auto;

@media #{$mq-md} {
@include bidi(((background-position, top left, top right),));
margin-left: 0;
margin-right: 0;
}
}
}

@mixin logo($product, $dir, $layout-size, $logo-size) {
Expand Down
18 changes: 18 additions & 0 deletions assets/sass/protocol/components/logos/_wordmark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,24 @@ $logo-sizes: (
margin-bottom: $layout-lg;
width: 521px;
}

&.mzp-l-wordmark-center {
background-position: center top;
margin-left: auto;
margin-right: auto;
}

&.mzp-l-wordmark-center-on-sm-md {
background-position: center top;
margin-left: auto;
margin-right: auto;

@media #{$mq-md} {
@include bidi(((background-position, top left, top right),));
margin-left: 0;
margin-right: 0;
}
}
}

@mixin wordmark($product, $dir, $layout-size, $logo-size) {
Expand Down
13 changes: 13 additions & 0 deletions components/branding/logo/logo.config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
variants:
- name: Centered
notes: Add the class `mzp-l-logo-center` for a centered logo.
context:
layout: 'mzp-l-logo-center'
size: 'lg'
- name: Centered on Mobile
notes: Add the class `mzp-l-logo-center-on-sm-md` for a centered logo only
in small to medium viewports, changing to the standard alignment (with the
text direction) in larger viewports.
context:
layout: 'mzp-l-logo-center-on-sm-md'
size: 'lg'
3 changes: 2 additions & 1 deletion components/branding/logo/logo.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
# size - Size class suffix (xs, sm, md, lg, xl)
# product - Product class suffix
# label - string
# layout - layout class (mzp-l-logo-center, mzp-l-logo-center-on-sm-md)
#}
<div class="mzp-c-logo mzp-t-logo-{% if size %}{{ size }}{% else %}md{% endif %} mzp-t-product-{% if product %}{{ product }}{% else %}firefox{% endif %}">
<div class="mzp-c-logo mzp-t-logo-{% if size %}{{ size }}{% else %}md{% endif %} mzp-t-product-{% if product %}{{ product }}{% else %}firefox{% endif %}{% if layout %} {{ layout }}{% endif %}">
{%- if label %}{{ label }}{% endif -%}
</div>
8 changes: 8 additions & 0 deletions components/branding/logo/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ Product classes:
- `mzp-t-product-pocket`
- `mzp-t-product-relay`

Logos are aligned with text by default (either left or right, depending on text
direction). Some additional layout classes are available to center the logo on
all viewports or only in small viewports.

Layout classes:
- `mzp-l-logo-center`
- `mzp-l-logo-center-on-sm-md`

### Tips
This component uses CSS image replacement to display a background image in place
of the element’s text content. If you use the logo as meaningful content like a
Expand Down
8 changes: 8 additions & 0 deletions components/branding/wordmark/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ Product classes:
- `mzp-t-product-pocket`
- `mzp-t-product-relay`

Wordmarks are aligned with text by default (either left or right, depending on
text direction). Some additional layout classes are available to center the
wordmark on all viewports or only in small viewports.

Layout classes:
- `mzp-l-wordmark-center`
- `mzp-l-wordmark-center-on-sm-md`

### Tips
This component uses CSS image replacement to display a background image in place
of the element’s text content. If you use the wordmark as meaningful content like
Expand Down
13 changes: 13 additions & 0 deletions components/branding/wordmark/wordmark.config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
variants:
- name: Centered
notes: Add the class `mzp-l-wordmark-center` for a centered wordmark.
context:
layout: 'mzp-l-wordmark-center'
size: 'lg'
- name: Centered on Mobile
notes: Add the class `mzp-l-wordmark-center-on-sm-md` for a centered wordmark
only in small to medium viewports, changing to the standard alignment (with
the text direction) in larger viewports.
context:
layout: 'mzp-l-wordmark-center-on-sm-md'
size: 'lg'
3 changes: 2 additions & 1 deletion components/branding/wordmark/wordmark.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
# size - Size class suffix (xs, sm, md, lg, xl)
# product - Product class suffix
# label - string
# layout - layout class (mzp-l-wordmark-center, mzp-l-wordmark-center-on-sm-md)
#}
<div class="mzp-c-wordmark mzp-t-wordmark-{% if size %}{{ size }}{% else %}md{% endif %} mzp-t-product-{% if product %}{{ product }}{% else %}firefox{% endif %}">
<div class="mzp-c-wordmark mzp-t-wordmark-{% if size %}{{ size }}{% else %}md{% endif %} mzp-t-product-{% if product %}{{ product }}{% else %}firefox{% endif %}{% if layout %} {{ layout }}{% endif %}">
{%- if label %}{{ label }}{% else %}Firefox Browser{% endif -%}
</div>

0 comments on commit 866628a

Please sign in to comment.