-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add inline description list variant (#3439)
Co-authored-by: rmccar <[email protected]>
- Loading branch information
1 parent
724ca48
commit 2f6bcf0
Showing
8 changed files
with
139 additions
and
22 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
...nents_description-list_example-inline-description-list_0_document_0_desktop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...onents_description-list_example-inline-description-list_0_document_1_tablet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...onents_description-list_example-inline-description-list_0_document_2_mobile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,23 +1,31 @@ | ||
{% macro onsDescriptionList(params) %} | ||
<dl | ||
class="ons-description-list ons-description-list__items ons-grid ons-grid--gutterless ons-u-cf{{ " " + params.classes if params.classes else "" }}" | ||
{% if params.id %}id="{{ params.id }}"{% endif %}{% if params.descriptionListLabel %} | ||
class="ons-description-list ons-description-list__items ons-grid ons-grid--gutterless{{ ' ons-description-list--inline' if params.variant == 'inline' else ' ons-u-cf' }}{{ ' ' + params.classes if params.classes else '' }}" | ||
{% if params.id %}id="{{ params.id }}"{% endif %} | ||
{% if params.descriptionListLabel %} | ||
title="{{ params.descriptionListLabel }}" aria-label="{{ params.descriptionListLabel }}" | ||
{% endif %} | ||
> | ||
{% for item in params.itemsList %} | ||
{% if item.term | length %} | ||
<dt class="ons-description-list__term ons-grid__col ons-col-{{ params.termCol }}@m">{{ item.term }}</dt> | ||
{% endif %} | ||
{% for descriptionItem in item.descriptions %} | ||
{% if descriptionItem.description | length %} | ||
<dd | ||
{% if descriptionItem.id %}id="{{ descriptionItem.id }}"{% endif %}class="ons-description-list__value ons-grid__col ons-col-{{ params.descriptionCol }}@m" | ||
<div class="ons-description-list__item"> | ||
{% if item.term | length %} | ||
<dt | ||
class="ons-description-list__term ons-grid__col ons-col-{{ params.termCol }}@{{ 'xs@l' if params.variant == 'inline' else 'm' }}" | ||
> | ||
{{- descriptionItem.description -}} | ||
</dd> | ||
{{- item.term -}} | ||
</dt> | ||
{% endif %} | ||
{% endfor %} | ||
{% for descriptionItem in item.descriptions %} | ||
{% if descriptionItem.description | length %} | ||
<dd | ||
{% if descriptionItem.id %}id="{{ descriptionItem.id }}"{% endif %} | ||
class="ons-description-list__value ons-grid__col ons-col-{{ params.descriptionCol }}@{{ 'xs@l' if params.variant == 'inline' else 'm' }}" | ||
> | ||
{{- descriptionItem.description -}} | ||
</dd> | ||
{% endif %} | ||
{% endfor %} | ||
</div> | ||
{% endfor %} | ||
</dl> | ||
{% endmacro %} |
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
58 changes: 58 additions & 0 deletions
58
src/components/description-list/example-inline-description-list.njk
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,58 @@ | ||
{% from "components/description-list/_macro.njk" import onsDescriptionList %} | ||
{{ | ||
onsDescriptionList({ | ||
"classes": "ons-u-mb-no", | ||
"descriptionListLabel": "Information about this business and its survey requirements", | ||
"variant": 'inline', | ||
"termCol": "4", | ||
"descriptionCol": "8", | ||
"itemsList": [ | ||
{ | ||
"term": "Survey:", | ||
"descriptions": [ | ||
{ | ||
"description": "Bricks & Blocks" | ||
} | ||
] | ||
}, | ||
{ | ||
"term": "RU Refs:", | ||
"descriptions": [ | ||
{ | ||
"description": "49900000118" | ||
}, | ||
{ | ||
"description": "49300005832" | ||
} | ||
] | ||
}, | ||
{ | ||
"term": "Business:", | ||
"descriptions": [ | ||
{ | ||
"description": "Bolts & Ratchets Ltd." | ||
} | ||
] | ||
}, | ||
{ | ||
"term": "Trading as:", | ||
"descriptions": [ | ||
{ | ||
"description": "Bolts & Ratchets" | ||
} | ||
] | ||
}, | ||
{ | ||
"term": "To:", | ||
"descriptions": [ | ||
{ | ||
"description": "Jacky Turner" | ||
}, | ||
{ | ||
"description": "Louise Goodland" | ||
} | ||
] | ||
} | ||
] | ||
}) | ||
}} |