From ef74f596e899489f77ce0fe105bdc93a4880a783 Mon Sep 17 00:00:00 2001 From: Precious Onyenaucheya Date: Mon, 23 Dec 2024 14:37:15 +0000 Subject: [PATCH 1/2] add link to description list --- ...ample-inline-description-list_0_document_0_desktop.png | 4 ++-- ...xample-inline-description-list_0_document_1_tablet.png | 4 ++-- ...xample-inline-description-list_0_document_2_mobile.png | 4 ++-- src/components/description-list/_description-list.scss | 4 ++++ src/components/description-list/_macro-options.md | 1 + src/components/description-list/_macro.njk | 8 +++++++- src/components/description-list/_macro.spec.js | 5 ++++- .../description-list/example-inline-description-list.njk | 3 ++- 8 files changed, 24 insertions(+), 9 deletions(-) diff --git a/backstop_data/bitmaps_reference/ds-vr-test__components_description-list_example-inline-description-list_0_document_0_desktop.png b/backstop_data/bitmaps_reference/ds-vr-test__components_description-list_example-inline-description-list_0_document_0_desktop.png index 0a08429eb9..501054bf24 100644 --- a/backstop_data/bitmaps_reference/ds-vr-test__components_description-list_example-inline-description-list_0_document_0_desktop.png +++ b/backstop_data/bitmaps_reference/ds-vr-test__components_description-list_example-inline-description-list_0_document_0_desktop.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:10b3fac1f117b5156eed79c8e8acd67c758bcf750706a405f707127224f296e5 -size 29101 +oid sha256:5e7e64f58cd1df264462b40d72a23456e35e8d3b36079d8d6163380da5669200 +size 29211 diff --git a/backstop_data/bitmaps_reference/ds-vr-test__components_description-list_example-inline-description-list_0_document_1_tablet.png b/backstop_data/bitmaps_reference/ds-vr-test__components_description-list_example-inline-description-list_0_document_1_tablet.png index 094d8bb803..787d83b991 100644 --- a/backstop_data/bitmaps_reference/ds-vr-test__components_description-list_example-inline-description-list_0_document_1_tablet.png +++ b/backstop_data/bitmaps_reference/ds-vr-test__components_description-list_example-inline-description-list_0_document_1_tablet.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f86583c3c214887dfe5a160e4f9e89827597713760b91ed7bef9650d6830abb3 -size 26901 +oid sha256:2f3ce338fc733ae77a2874dca95f1f3496ca0660ce7d0f9ff1ebec76caa226f8 +size 27025 diff --git a/backstop_data/bitmaps_reference/ds-vr-test__components_description-list_example-inline-description-list_0_document_2_mobile.png b/backstop_data/bitmaps_reference/ds-vr-test__components_description-list_example-inline-description-list_0_document_2_mobile.png index f5141703a9..46fe8f06e5 100644 --- a/backstop_data/bitmaps_reference/ds-vr-test__components_description-list_example-inline-description-list_0_document_2_mobile.png +++ b/backstop_data/bitmaps_reference/ds-vr-test__components_description-list_example-inline-description-list_0_document_2_mobile.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:24353f18540d373c96f4de57c56514d2dfc1c2d792c92436bff1ae9e0fd55e35 -size 23850 +oid sha256:916702efd8bc81c6e9b58f8ff13e097c11f95d564f09a88cbf6a58f7d284e6ba +size 23969 diff --git a/src/components/description-list/_description-list.scss b/src/components/description-list/_description-list.scss index bb13bae702..12aea40244 100644 --- a/src/components/description-list/_description-list.scss +++ b/src/components/description-list/_description-list.scss @@ -60,4 +60,8 @@ } } } + + &__link { + display: inline; + } } diff --git a/src/components/description-list/_macro-options.md b/src/components/description-list/_macro-options.md index 324f027775..3a64f09971 100644 --- a/src/components/description-list/_macro-options.md +++ b/src/components/description-list/_macro-options.md @@ -21,3 +21,4 @@ | ----------- | ------ | -------- | ----------------------------------------------------- | | id | string | false | The HTML `id` for the description of the related term | | description | string | true | The value of the description of the related term | +| url | string | false | The url of the description of the related term | diff --git a/src/components/description-list/_macro.njk b/src/components/description-list/_macro.njk index 329491b2c9..92e9890a1f 100644 --- a/src/components/description-list/_macro.njk +++ b/src/components/description-list/_macro.njk @@ -21,7 +21,13 @@ {% 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 -}} + {%- if descriptionItem.url -%} + + {{- descriptionItem.description -}} + + {%- else -%} + {{- descriptionItem.description -}} + {%- endif -%} {% endif %} {% endfor %} diff --git a/src/components/description-list/_macro.spec.js b/src/components/description-list/_macro.spec.js index fa45111ceb..508a51cd6d 100644 --- a/src/components/description-list/_macro.spec.js +++ b/src/components/description-list/_macro.spec.js @@ -30,6 +30,7 @@ const EXAMPLE_DESCRIPTION_LIST_FULL = { { id: 'description-3', description: '49300005832', + url: '#', }, ], }, @@ -142,7 +143,9 @@ describe('macro: description-list', () => { expect($listElements[4].tagName).toBe('dd'); expect($($listElements[4]).attr('id')).toBe('description-3'); - expect($($listElements[4]).text()).toBe('49300005832'); + const $link = $($listElements[4]).find('a'); + expect($link.attr('href')).toBe('#'); + expect($link.text()).toBe('49300005832'); }); it.each([ diff --git a/src/components/description-list/example-inline-description-list.njk b/src/components/description-list/example-inline-description-list.njk index e7114ffd1e..a43605286c 100644 --- a/src/components/description-list/example-inline-description-list.njk +++ b/src/components/description-list/example-inline-description-list.njk @@ -49,7 +49,8 @@ "description": "Jacky Turner" }, { - "description": "Louise Goodland" + "description": "Louise Goodland", + 'url': '#' } ] } From e3ee96fd7f0fe67002904c652aaaa0a1f3867731 Mon Sep 17 00:00:00 2001 From: SriHV Date: Mon, 6 Jan 2025 15:13:13 +0000 Subject: [PATCH 2/2] removed css style --- src/components/description-list/_description-list.scss | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/components/description-list/_description-list.scss b/src/components/description-list/_description-list.scss index 12aea40244..bb13bae702 100644 --- a/src/components/description-list/_description-list.scss +++ b/src/components/description-list/_description-list.scss @@ -60,8 +60,4 @@ } } } - - &__link { - display: inline; - } }