-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
833 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
{# | ||
Params | ||
- title_text (string) (optional): The text to be displayed as the heading | ||
- quote_size (string) (required): The size of the quote. Possible values are 'small', 'medium', 'large'. Default is 'medium'. | ||
- quote_text (string) (required): The text of the quote. The macro will surround it with quotes, so there is no need to quote it yourself. | ||
- citation_source_name_text (string) (optional): The name of the source being quoted | ||
- citation_source_title_text (string) (optional): The title of the source being quoted | ||
- citation_source_organisation_text (string) (optional): The organisation associated with the source being quoted. | ||
- is_shallow (boolean) (optional): Whether the quote wrapper pattern should be displayed in a shallow section. Defaults to false. | ||
Slots | ||
- signpost_image (optional): The signpost_image of the source being quoted | ||
- heading_link (optional): Link to be displayed beside the heading text | ||
- cta (optional): Contents of the call to action block to be displayed below the quote | ||
- image (optional): An image to be displayed below the quote | ||
#} | ||
{%- macro quote_wrapper( | ||
title_text="", | ||
quote_size="medium", | ||
quote_text="", | ||
citation_source_name_text="", | ||
citation_source_title_text="", | ||
citation_source_organisation_text="", | ||
is_shallow=False | ||
) -%} | ||
{% set heading_link_content = caller('heading_link') %} | ||
{% set has_heading_link = heading_link_content|trim|length > 0 %} | ||
{% set has_title = title_text|length > 0 %} | ||
{% set has_heading_row = has_title or has_heading_link %} | ||
{% set signpost_image_content = caller('signpost_image') %} | ||
{% set has_signpost_image = signpost_image_content|trim|length > 0 %} | ||
{% set has_citation_source_name = citation_source_name_text|trim|length > 0 %} | ||
{% set has_citation_source_title = citation_source_title_text|trim|length > 0 %} | ||
{% set has_citation_source_organisation = citation_source_organisation_text|trim|length > 0 %} | ||
{% set has_citation = has_citation_source_name or has_citation_source_title or has_citation_source_organisation %} | ||
{% set cta_content = caller('cta') %} | ||
{% set has_cta = cta_content|trim|length > 0 %} | ||
{% set image_content = caller('image') %} | ||
{% set has_image = image_content|trim|length > 0 %} | ||
{% set quote_size = quote_size|trim|lower %} | ||
|
||
{# Translate quote size param to quote heading level #} | ||
{% if quote_size == 'large' %} | ||
{% set quote_heading_level = 2 %} | ||
{% elif quote_size == 'small' %} | ||
{% set quote_heading_level = 6 %} | ||
{% else %} | ||
{% set quote_heading_level = 4 %} | ||
{% endif %} | ||
|
||
{%- macro _quote_body() -%} | ||
{#- Only use shallow section spacing if a another block follows -#} | ||
<div {% if has_cta or has_image or has_citation %} class="p-section--shallow"{% endif %}> | ||
<p class="p-heading--{{ quote_heading_level }}"> | ||
<i> | ||
“{{ quote_text }}” | ||
</i> | ||
</p> | ||
</div> | ||
{%- endmacro %} | ||
|
||
{%- macro _citation_block() -%} | ||
{%- if has_citation -%} | ||
{#- Optional citation block -#} | ||
<p> | ||
{% if has_citation_source_name -%} | ||
{#- Optional citation source name -#} | ||
<strong>{{ citation_source_name_text }}</strong> | ||
{% if has_citation_source_title or has_citation_source_organisation -%} | ||
{#- If the citation name is followed by title and/or organisation, add a line break -#} | ||
<br> | ||
{% endif -%} | ||
{% endif -%} | ||
{% if has_citation_source_title or has_citation_source_organisation -%} | ||
{#- Optional citation source title and/or organisation -#} | ||
<span class="u-text--muted"> | ||
{% if has_citation_source_title -%} | ||
{#- Optional citation source title -#} | ||
{{ citation_source_title_text }} | ||
{%- if has_citation_source_organisation %} | ||
{#- Add a line break between the title and org if both are present -#} | ||
<br> | ||
{%- endif %} | ||
{% endif %} | ||
{%- if has_citation_source_organisation -%} | ||
{#- Optional citation source organisation -#} | ||
{{ citation_source_organisation_text }} | ||
{%- endif %} | ||
</span> | ||
{%- endif %} | ||
</p> | ||
{% endif %} | ||
{%- endmacro -%} | ||
|
||
{%- macro _heading_block() %} | ||
{% if has_heading_row -%} | ||
{#- Optional heading -#} | ||
<div class="p-section--shallow"> | ||
<hr class="p-rule--highlight is-fixed-width"> | ||
<div class="row"> | ||
{%- if has_title %} | ||
{#- Optional heading text -#} | ||
<div class="col-3 col-medium-2"> | ||
<p class="p-muted-heading">{{ title_text }}</p> | ||
</div> | ||
{%- endif -%} | ||
|
||
{%- if has_heading_link %} | ||
{#- Optional heading link -#} | ||
<div class="col-3 col-medium-4 col-start-large-10 col-start-medium-3"> | ||
<p class="p-text--default"> | ||
{{ heading_link_content }} | ||
</p> | ||
</div> | ||
{% endif -%} | ||
</div> | ||
</div> | ||
{% endif -%} | ||
{%- endmacro %} | ||
|
||
<div class="p-section{% if is_shallow %}--shallow{% endif %}"> | ||
{{- _heading_block() -}} | ||
<div class="row"> | ||
{% if has_signpost_image -%} | ||
{#- Optional signpost image -#} | ||
<div class="col-3 col-medium-2"> | ||
<div class="p-section--shallow"> | ||
{{ signpost_image_content }} | ||
</div> | ||
</div> | ||
{% endif -%} | ||
{#- Skip to fourth column if the signpost_image (which takes up first three columns) is missing -#} | ||
<div class="col-9 col-start-large-4 col-medium-4 col-start-medium-3"> | ||
<hr class="p-rule--muted"> | ||
{% if has_citation -%} | ||
{#- When a citation is present, wrap the quote and citation in a nested grid to space them properly -#} | ||
<div class="row"> | ||
<div class="col-6"> | ||
{{ _quote_body() }} | ||
</div> | ||
<div class="col-3"> | ||
<hr class="p-rule--muted u-hide--large"> | ||
{{ _citation_block() }} | ||
</div> | ||
</div> | ||
{% else -%} | ||
{#- When no citation is present, display quote body without a nested grid -#} | ||
{{ _quote_body() }} | ||
{% endif -%} | ||
|
||
{%- if has_cta or has_image -%} | ||
{#- Optional CTA and/or image block -#} | ||
{%- if has_cta %} | ||
{#- Optional CTA block -#} | ||
<div class="p-cta-block"> | ||
{{ cta_content }} | ||
</div> | ||
{% endif -%} | ||
|
||
{% if has_image -%} | ||
{#- Optional image block -#} | ||
{{ image_content }} | ||
{% endif -%} | ||
{% endif -%} | ||
</div> | ||
</div> | ||
</div> | ||
{% endmacro -%} |
25 changes: 25 additions & 0 deletions
25
templates/docs/examples/patterns/quote-wrapper/combined.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{% extends "_layouts/examples.html" %} | ||
{% block title %}Quote Wrapper / Combined{% endblock %} | ||
|
||
{% block standalone_css %}patterns_all{% endblock %} | ||
|
||
{% block content %} | ||
{% with is_combined = true %} | ||
<section>{% include 'docs/examples/patterns/quote-wrapper/large.html' %}</section> | ||
<section>{% include 'docs/examples/patterns/quote-wrapper/large-no-cta-image-or-citation.html' %}</section> | ||
<section>{% include 'docs/examples/patterns/quote-wrapper/large-no-signpost.html' %}</section> | ||
<section>{% include 'docs/examples/patterns/quote-wrapper/large-no-citation.html' %}</section> | ||
<section>{% include 'docs/examples/patterns/quote-wrapper/large-no-header.html' %}</section> | ||
<section>{% include 'docs/examples/patterns/quote-wrapper/large-no-header-no-signpost.html' %}</section> | ||
<section>{% include 'docs/examples/patterns/quote-wrapper/large-shallow.html' %}</section> | ||
<section>{% include 'docs/examples/patterns/quote-wrapper/large-minimal.html' %}</section> | ||
<section>{% include 'docs/examples/patterns/quote-wrapper/medium.html' %}</section> | ||
<section>{% include 'docs/examples/patterns/quote-wrapper/medium-no-signpost.html' %}</section> | ||
<section>{% include 'docs/examples/patterns/quote-wrapper/medium-no-citation.html' %}</section> | ||
<section>{% include 'docs/examples/patterns/quote-wrapper/medium-no-header.html' %}</section> | ||
<section>{% include 'docs/examples/patterns/quote-wrapper/small.html' %}</section> | ||
<section>{% include 'docs/examples/patterns/quote-wrapper/small-no-signpost.html' %}</section> | ||
<section>{% include 'docs/examples/patterns/quote-wrapper/small-no-citation.html' %}</section> | ||
<section>{% include 'docs/examples/patterns/quote-wrapper/small-no-header.html' %}</section> | ||
{% endwith %} | ||
{% endblock %} |
16 changes: 16 additions & 0 deletions
16
templates/docs/examples/patterns/quote-wrapper/large-minimal.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{% extends "_layouts/examples.html" %} | ||
{% from "_macros/quote-wrapper.jinja" import quote_wrapper %} | ||
|
||
{% block title %}Quote Wrapper / Large quote / Minimal{% endblock %} | ||
{% block standalone_css %}patterns_all{% endblock %} | ||
|
||
{% block content %} | ||
|
||
{% call(slot) quote_wrapper( | ||
quote_size="large", | ||
quote_text="This is a company where intelligence and learning are highly valued." | ||
) -%} | ||
|
||
{% endcall -%} | ||
|
||
{% endblock %} |
35 changes: 35 additions & 0 deletions
35
templates/docs/examples/patterns/quote-wrapper/large-no-citation.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{% extends "_layouts/examples.html" %} | ||
{% from "_macros/quote-wrapper.jinja" import quote_wrapper %} | ||
|
||
{% block title %}Quote Wrapper / Large quote / No citation{% endblock %} | ||
{% block standalone_css %}patterns_all{% endblock %} | ||
|
||
{% block content %} | ||
|
||
{% call(slot) quote_wrapper( | ||
title_text="Our hiring process", | ||
quote_size="large", | ||
quote_text="This is a company where intelligence and learning are highly valued." | ||
) -%} | ||
|
||
{%- if slot == 'heading_link' -%} | ||
<a href="#">All the success stories ›</a> | ||
{%- endif -%} | ||
|
||
{%- if slot == 'signpost_image' -%} | ||
<img src="https://assets.ubuntu.com/v1/8c8bd206-example-logo-h2.png" width="114" alt="Canonical logo"> | ||
{%- endif -%} | ||
|
||
{%- if slot == 'cta' -%} | ||
<a href="#">Explore careers ›</a> | ||
{%- endif -%} | ||
|
||
{%- if slot == 'image' -%} | ||
<div class="p-image-container--cinematic is-cover"> | ||
<img class="p-image-container__image" src="https://assets.ubuntu.com/v1/da3fbf74-summit2022_crowd.png" alt="Ubuntu Summit crowd"> | ||
</div> | ||
{%- endif -%} | ||
|
||
{% endcall -%} | ||
|
||
{% endblock %} |
28 changes: 28 additions & 0 deletions
28
templates/docs/examples/patterns/quote-wrapper/large-no-cta-image-or-citation.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{% extends "_layouts/examples.html" %} | ||
{% from "_macros/quote-wrapper.jinja" import quote_wrapper %} | ||
|
||
{% block title %}Quote Wrapper / Large quote / No CTA, image, or citation{% endblock %} | ||
{% block standalone_css %}patterns_all{% endblock %} | ||
|
||
{% block content %} | ||
|
||
{% call(slot) quote_wrapper( | ||
title_text="Our hiring process", | ||
quote_size="large", | ||
quote_text="This is a company where intelligence and learning are highly valued.", | ||
citation_source_name_text="Alyson Richens", | ||
citation_source_title_text="Customer Success Manager", | ||
citation_source_organisation_text="Canonical" | ||
) -%} | ||
|
||
{%- if slot == 'heading_link' -%} | ||
<a href="#">All the success stories ›</a> | ||
{%- endif -%} | ||
|
||
{%- if slot == 'signpost_image' -%} | ||
<img src="https://assets.ubuntu.com/v1/8c8bd206-example-logo-h2.png" width="114" alt="Canonical logo"> | ||
{%- endif -%} | ||
|
||
{% endcall -%} | ||
|
||
{% endblock %} |
29 changes: 29 additions & 0 deletions
29
templates/docs/examples/patterns/quote-wrapper/large-no-header-no-signpost.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{% extends "_layouts/examples.html" %} | ||
{% from "_macros/quote-wrapper.jinja" import quote_wrapper %} | ||
|
||
{% block title %}Quote Wrapper / Large quote / No header or signpost{% endblock %} | ||
{% block standalone_css %}patterns_all{% endblock %} | ||
|
||
{% block content %} | ||
|
||
{% call(slot) quote_wrapper( | ||
quote_size="large", | ||
quote_text="This is a company where intelligence and learning are highly valued.", | ||
citation_source_name_text="Alyson Richens", | ||
citation_source_title_text="Customer Success Manager", | ||
citation_source_organisation_text="Canonical" | ||
) -%} | ||
|
||
{%- if slot == 'cta' -%} | ||
<a href="#">Explore careers ›</a> | ||
{%- endif -%} | ||
|
||
{%- if slot == 'image' -%} | ||
<div class="p-image-container--cinematic is-cover"> | ||
<img class="p-image-container__image" src="https://assets.ubuntu.com/v1/da3fbf74-summit2022_crowd.png" alt="Ubuntu Summit crowd"> | ||
</div> | ||
{%- endif -%} | ||
|
||
{% endcall -%} | ||
|
||
{% endblock %} |
33 changes: 33 additions & 0 deletions
33
templates/docs/examples/patterns/quote-wrapper/large-no-header.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{% extends "_layouts/examples.html" %} | ||
{% from "_macros/quote-wrapper.jinja" import quote_wrapper %} | ||
|
||
{% block title %}Quote Wrapper / Large quote / No header{% endblock %} | ||
{% block standalone_css %}patterns_all{% endblock %} | ||
|
||
{% block content %} | ||
|
||
{% call(slot) quote_wrapper( | ||
quote_size="large", | ||
quote_text="This is a company where intelligence and learning are highly valued.", | ||
citation_source_name_text="Alyson Richens", | ||
citation_source_title_text="Customer Success Manager", | ||
citation_source_organisation_text="Canonical" | ||
) -%} | ||
|
||
{%- if slot == 'signpost_image' -%} | ||
<img src="https://assets.ubuntu.com/v1/8c8bd206-example-logo-h2.png" width="114" alt="Canonical logo"> | ||
{%- endif -%} | ||
|
||
{%- if slot == 'cta' -%} | ||
<a href="#">Explore careers ›</a> | ||
{%- endif -%} | ||
|
||
{%- if slot == 'image' -%} | ||
<div class="p-image-container--cinematic is-cover"> | ||
<img class="p-image-container__image" src="https://assets.ubuntu.com/v1/da3fbf74-summit2022_crowd.png" alt="Ubuntu Summit crowd"> | ||
</div> | ||
{%- endif -%} | ||
|
||
{% endcall -%} | ||
|
||
{% endblock %} |
34 changes: 34 additions & 0 deletions
34
templates/docs/examples/patterns/quote-wrapper/large-no-signpost.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{% extends "_layouts/examples.html" %} | ||
{% from "_macros/quote-wrapper.jinja" import quote_wrapper %} | ||
|
||
{% block title %}Quote Wrapper / Large quote / No signpost{% endblock %} | ||
{% block standalone_css %}patterns_all{% endblock %} | ||
|
||
{% block content %} | ||
|
||
{% call(slot) quote_wrapper( | ||
title_text="Our hiring process", | ||
quote_size="large", | ||
quote_text="This is a company where intelligence and learning are highly valued.", | ||
citation_source_name_text="Alyson Richens", | ||
citation_source_title_text="Customer Success Manager", | ||
citation_source_organisation_text="Canonical" | ||
) -%} | ||
|
||
{%- if slot == 'heading_link' -%} | ||
<a href="#">All the success stories ›</a> | ||
{%- endif -%} | ||
|
||
{%- if slot == 'cta' -%} | ||
<a href="#">Explore careers ›</a> | ||
{%- endif -%} | ||
|
||
{%- if slot == 'image' -%} | ||
<div class="p-image-container--cinematic is-cover"> | ||
<img class="p-image-container__image" src="https://assets.ubuntu.com/v1/da3fbf74-summit2022_crowd.png" alt="Ubuntu Summit crowd"> | ||
</div> | ||
{%- endif -%} | ||
|
||
{% endcall -%} | ||
|
||
{% endblock %} |
Oops, something went wrong.