From 8fa53efa4e792da87847932bb623cd0a69d4477b Mon Sep 17 00:00:00 2001 From: Bali Birch-Lee Date: Fri, 12 Apr 2024 15:03:11 +0100 Subject: [PATCH] removes call to action component and references --- .../call-to-action/_call-to-action.scss | 8 ---- .../call-to-action/_macro-options.md | 12 ----- src/components/call-to-action/_macro.njk | 22 --------- src/components/call-to-action/_macro.spec.js | 48 ------------------- .../example-call-to-action-default.njk | 14 ------ src/scss/main.scss | 1 - 6 files changed, 105 deletions(-) delete mode 100644 src/components/call-to-action/_call-to-action.scss delete mode 100644 src/components/call-to-action/_macro-options.md delete mode 100644 src/components/call-to-action/_macro.njk delete mode 100644 src/components/call-to-action/_macro.spec.js delete mode 100644 src/components/call-to-action/example-call-to-action-default.njk diff --git a/src/components/call-to-action/_call-to-action.scss b/src/components/call-to-action/_call-to-action.scss deleted file mode 100644 index 2cbb68e7ee..0000000000 --- a/src/components/call-to-action/_call-to-action.scss +++ /dev/null @@ -1,8 +0,0 @@ -.ons-call-to-action { - background: var(--ons-color-cta-bg); - padding: 0.85rem 0; - - &__heading { - padding-right: 0.2rem; - } -} diff --git a/src/components/call-to-action/_macro-options.md b/src/components/call-to-action/_macro-options.md deleted file mode 100644 index f54eb46f72..0000000000 --- a/src/components/call-to-action/_macro-options.md +++ /dev/null @@ -1,12 +0,0 @@ -| Name | Type | Required | Description | -| ------------- | ------------------- | -------- | ------------------------------------------------- | -| headingText | string | true | The heading for the component | -| paragraphText | string | false | The descriptive text for the component | -| button | `Object` | true | Settings for the [call to action button](#button) | - -## CTAButton - -| Name | Type | Required | Description | -| ---- | ------ | -------- | --------------------------------------------------- | -| text | string | true | The text label for the button | -| url | string | true | The URL for the `href` attribute of the button link | diff --git a/src/components/call-to-action/_macro.njk b/src/components/call-to-action/_macro.njk deleted file mode 100644 index 169b08ec00..0000000000 --- a/src/components/call-to-action/_macro.njk +++ /dev/null @@ -1,22 +0,0 @@ -{% macro onsCallToAction(params) %} - {% from "components/button/_macro.njk" import onsButton %} -
-
-
-
-

{{ params.headingText }}

- {% if params.paragraphText %} -

{{ params.paragraphText }}

- {% endif %} -
-
- {{ onsButton({ - "text": params.button.text, - "url": params.button.url, - "variants": "small" - }) }} -
-
-
-
-{% endmacro %} diff --git a/src/components/call-to-action/_macro.spec.js b/src/components/call-to-action/_macro.spec.js deleted file mode 100644 index fe86743f9f..0000000000 --- a/src/components/call-to-action/_macro.spec.js +++ /dev/null @@ -1,48 +0,0 @@ -/** @jest-environment jsdom */ - -import * as cheerio from 'cheerio'; - -import axe from '../../tests/helpers/axe'; -import { renderComponent, templateFaker } from '../../tests/helpers/rendering'; - -const EXAMPLE_CALL_TO_ACTION = { - headingText: 'Call to action heading.', - paragraphText: 'Descriptive text about call to action', - button: { - text: 'Start', - url: 'https://example.com/start', - }, -}; - -describe('macro: call-to-action', () => { - it('passes jest-axe checks', async () => { - const $ = cheerio.load(renderComponent('call-to-action', EXAMPLE_CALL_TO_ACTION)); - - const results = await axe($.html()); - expect(results).toHaveNoViolations(); - }); - - it('has the provided `headingText`', () => { - const $ = cheerio.load(renderComponent('call-to-action', EXAMPLE_CALL_TO_ACTION)); - - const headingText = $('.ons-call-to-action__heading').text().trim(); - expect(headingText).toBe('Call to action heading.'); - }); - - it('has the provided `paragraphText`', () => { - const $ = cheerio.load(renderComponent('call-to-action', EXAMPLE_CALL_TO_ACTION)); - - const paragraphText = $('.ons-call-to-action__text').text().trim(); - expect(paragraphText).toBe('Descriptive text about call to action'); - }); - - it('outputs the expected call-to-action button', () => { - const faker = templateFaker(); - const buttonSpy = faker.spy('button'); - - faker.renderComponent('call-to-action', EXAMPLE_CALL_TO_ACTION); - - expect(buttonSpy.occurrences[0]).toHaveProperty('text', 'Start'); - expect(buttonSpy.occurrences[0]).toHaveProperty('url', 'https://example.com/start'); - }); -}); diff --git a/src/components/call-to-action/example-call-to-action-default.njk b/src/components/call-to-action/example-call-to-action-default.njk deleted file mode 100644 index 02b38d177d..0000000000 --- a/src/components/call-to-action/example-call-to-action-default.njk +++ /dev/null @@ -1,14 +0,0 @@ ---- -"fullWidth": true ---- -{% from "components/call-to-action/_macro.njk" import onsCallToAction %} -{{- - onsCallToAction({ - "headingText": 'Call to action heading.', - "paragraphText": 'Descriptive text about call to action', - "button": { - "text": 'Start', - "url": '#0' - } - }) -}} diff --git a/src/scss/main.scss b/src/scss/main.scss index d33c1d5c6f..a68d4173ef 100644 --- a/src/scss/main.scss +++ b/src/scss/main.scss @@ -10,7 +10,6 @@ @import '../components/breadcrumbs/breadcrumbs'; @import '../components/browser-banner/browser-banner'; @import '../components/button/button'; -@import '../components/call-to-action/call-to-action'; @import '../components/card/card'; @import '../components/checkboxes/checkbox'; @import '../components/checkboxes/checkboxes';