Skip to content

Commit

Permalink
update param (#3304)
Browse files Browse the repository at this point in the history
  • Loading branch information
precious-onyenaucheya-ons authored Sep 5, 2024
1 parent 87a148c commit 371f03f
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/components/external-link/_macro-options.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
| Name | Type | Required | Description |
| -------------------- | ------ | -------- | -------------------------------------------------------------------------------------------------- |
| url | string | true | The URL for the `href` attribute of the external link |
| linkText | string | true | Text for the external link |
| text | string | true | Text for the external link |
| classes | string | false | Classes to apply to the link |
| newWindowDescription | string | false | Use to set context after the `linkText` label for screen readers. Defaults to “opens in a new tab” |
2 changes: 1 addition & 1 deletion src/components/external-link/_macro.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{% macro onsExternalLink(params) %}
<a href="{{ params.url }}" class="ons-external-link{{ ' ' + params.classes if params.classes else '' }}" target="_blank" rel="noopener">
<span class="ons-external-link__text"> {{- params.linkText | safe -}} </span
<span class="ons-external-link__text"> {{- params.text | safe -}} </span
><span class="ons-external-link__icon">&nbsp;{{- onsIcon({"iconType": 'external-link'}) -}} </span
><span class="ons-external-link__new-window-description ons-u-vh"
>({{- params.newWindowDescription | default("opens in a new tab") -}})</span
Expand Down
2 changes: 1 addition & 1 deletion src/components/external-link/_macro.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { renderComponent, templateFaker } from '../../tests/helpers/rendering';

const EXAMPLE_EXTERNAL_LINK = {
url: 'http://example.com',
linkText: 'Example link',
text: 'Example link',
};

describe('macro: external-link', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/external-link/example-external-link.njk
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{{
onsExternalLink({
"url": "#0",
"linkText": "link to an external website"
"text": "link to an external website"
})
}}
</p>
4 changes: 2 additions & 2 deletions src/components/footer/_macro.njk
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,15 @@
{{
onsExternalLink({
"url": params.OGLLink.url | default('https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/'),
"linkText": params.OGLLink.link | default('Drwydded Llywodraeth Leol v3.0')
"text": params.OGLLink.link | default('Drwydded Llywodraeth Leol v3.0')
})
}}{{ params.OGLLink.post | default(', oni bai y nodir fel arall') }}
{% else %}
{{ params.OGLLink.pre | default('All content is available under the') }}
{{
onsExternalLink({
"url": params.OGLLink.url | default('https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/'),
"linkText": params.OGLLink.link | default('Open Government Licence v3.0')
"text": params.OGLLink.link | default('Open Government Licence v3.0')
})
}}{{ params.OGLLink.post | default(', except where otherwise stated') }}
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion src/components/footer/_macro.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ describe('macro: footer', () => {
expect(externalLinkSpy.occurrences).toContainEqual(
expect.objectContaining({
url: 'https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/',
linkText: 'Open Government Licence v3.0',
text: 'Open Government Licence v3.0',
}),
);
});
Expand Down
2 changes: 1 addition & 1 deletion src/components/list/_macro.njk
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
{{
onsExternalLink({
"url": item.url,
"linkText": itemText
"text": itemText
})
}}
{%- else -%}
Expand Down
2 changes: 1 addition & 1 deletion src/components/list/_macro.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ describe('macro: list', () => {

expect(externalLinkSpy.occurrences[0]).toEqual({
url: 'https://example.com/external-link',
linkText: expectedItemText,
text: expectedItemText,
});
});

Expand Down
2 changes: 1 addition & 1 deletion src/components/phase-banner/example-phase-banner-alpha.njk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{{
onsExternalLink({
"url": "#0",
"linkText": "give feedback"
"text": "give feedback"
})
}}
{% endset %}
Expand Down
2 changes: 1 addition & 1 deletion src/components/phase-banner/example-phase-banner-beta.njk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{{
onsExternalLink({
"url": "#0",
"linkText": "give feedback"
"text": "give feedback"
})
}}
{% endset %}
Expand Down
2 changes: 1 addition & 1 deletion src/components/video/_macro.njk
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
onsExternalLink({
"url": params.videoLinkURL,
"classes": "ons-video__link ons-js-video-placeholder ons-u-db",
"linkText": linkContents
"text": linkContents
})
}}
<iframe
Expand Down

0 comments on commit 371f03f

Please sign in to comment.