mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 16:24:08 -04:00
Make components for nicely formatted lists
We have a couple of places now where we want nice lists made from `list`s, eg - ‘name’, ‘date’ and ‘phone number’ - ((firstname)) ((lastname)) or ((date)) This commit adds a more generic component for doing this, which can handle: - 1, 2, and n items - comma (or other character) separated lists - a conjunction between the last and one-before-last item - characters to be inserted before and after each item, eg an opening and closing HTML tag It also pulls the `list_of_placeholders` component from the breaking change page, and makes it use the `formatted_list` component under the hood.
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
{% from "components/textbox.html" import textbox %}
|
||||
{% from "components/file-upload.html" import file_upload %}
|
||||
{% from "components/api-key.html" import api_key %}
|
||||
{% from "components/list.html" import formatted_list %}
|
||||
|
||||
{% block page_title %}
|
||||
Styleguide – GOV.UK Notify
|
||||
@@ -230,4 +231,23 @@
|
||||
|
||||
{{ api_key('d30512af92e1386d63b90e5973b49a10') }}
|
||||
|
||||
|
||||
<h2 class="heading-large">Formatted list</h2>
|
||||
|
||||
<p>
|
||||
{{ formatted_list('A', prefix="one item called") }}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
{{ formatted_list('AB', prefix_plural="two items called") }}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
{{ formatted_list('ABC') }}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
{{ formatted_list('ABCD', before_each='<strike>', after_each='</strike>', conjunction='or') }}
|
||||
</p>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user