diff --git a/.eslintrc b/.eslintrc index d1bc466bf..c649764b8 100644 --- a/.eslintrc +++ b/.eslintrc @@ -21,7 +21,7 @@ "react/jsx-filename-extension": "off", "react/no-danger": "off", "import/no-extraneous-dependencies": ["error", {"devDependencies": ["importers/**/*.js"]}], - "react/jsx-curly-newline": "off", // already handled by prettier, but differently, so we have to disable one + "react/jsx-curly-newline": "off", "quotes": [ 2, "single", diff --git a/.nvmrc b/.nvmrc index 9e15be387..91f7588a1 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v16.20.0 +v18.20.0 diff --git a/README.md b/README.md index 4767a06ab..1330da411 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,20 @@ Comic Relief React Component Library [![GitHub Actions](https://github.com/comicrelief/component-library/actions/workflows/main.yml/badge.svg)](https://github.com/comicrelief/component-library/actions) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) -React components to be shared across Comic Relief applications + + + +# Rebuild notes: +### All diffs in main exported files are non-functional: +- Styled-components & syntax updates => CSS output is identical, issues are around assumed "&" in nested CSS. +- Confetti updated to newer react-canvas-confetti API => new prop names to activate confetti. +- _TriggerConfetti.js removed => was likely a private helper no longer needed. + +### Have added a couple of scripts I worked on to make deving playwright locally less insanity inducing. + + + +# React components to be shared across Comic Relief applications ### Use diff --git a/babel.config.js b/babel.config.js index 0f8518bde..befa8ee62 100644 --- a/babel.config.js +++ b/babel.config.js @@ -2,10 +2,12 @@ module.exports = function (api) { api.cache(true); - const presets = [['react-app', { absoluteRuntime: false }]]; + const presets = [ + ['@babel/preset-env', { targets: { node: 'current' } }], + ['@babel/preset-react', { runtime: 'automatic' }] + ]; const plugins = [ - ['babel-plugin-styled-components'], - ['import', { libraryName: 'lodash', libraryDirectory: '', camel2DashComponentName: false }] + ['babel-plugin-styled-components'] ]; return { diff --git a/component-checks-Atoms.md b/component-checks-Atoms.md new file mode 100644 index 000000000..7bfd6f07e --- /dev/null +++ b/component-checks-Atoms.md @@ -0,0 +1,131 @@ + +### Notes: +- styled-components v6 the "&" in "&:hover" is no longer implicit +- haven't replaced axios remember... + +# Gotchas: +- new prop names for confetti usage no needed in CR.com + + +## Atoms + +- [ ] AmbientVideo + - [X] Diff check + - [X] Visual check of dev server + - [X] Example functionality check + - [X] code manual lint + +- [ ] Button + - [X] Diff check + - [X] Visual check of dev server + - [X] Example functionality check + - [ ] code manual lint + +- [ ] ButtonWithStates + - [X] Diff check + - [X] Visual check of dev server + - [X] Example functionality check + - [X] code manual lint + +- [ ] Checkbox + - [X] Diff check + - [X] Visual check of dev server + - [X] Example functionality check + - [X] code manual lint + +- [ ] Confetti + - [X] Diff check + - [X] Visual check of dev server + - [X] Example functionality check + - [X] code manual lint + +- [ ] ErrorText + - [X] Diff check + - [X] Visual check of dev server + - [X] Example functionality check + - [X] code manual lint + +- [ ] InfoMessage + - [X] Diff check + - [X] Visual check of dev server + - [X] Example functionality check + - [X] code manual lint + +- [ ] Input + - [X] Diff check + - [X] Visual check of dev server + - [X] Example functionality check + - [X] code manual lint + +- [ ] Label + - [X] Diff check + - [X] Visual check of dev server + - [X] Example functionality check + - [X] code manual lint + +- [ ] Link + - [X] Diff check + - [X] Visual check of dev server + - [X] Example functionality check + - [X] code manual lint + +- [ ] Logo + - [X] Diff check + - [X] Visual check of dev server + - [X] Example functionality check + - [X] code manual lint + +- [ ] Pagination + - [X] Diff check + - [X] Visual check of dev server + - [X] Example functionality check + - [X] code manual lint + +- [ ] Picture + - [X] Diff check + - [X] Visual check of dev server + - [X] Example functionality check + - [X] code manual lint + +- [ ] RadioButton + - [X] Diff check + - [X] Visual check of dev server + - [X] Example functionality check + - [X] code manual lint + +- [ ] RichText + - [X] Diff check + - [X] Visual check of dev server + - [X] Example functionality check + - [X] code manual lint + +- [ ] Select + - [X] Diff check + - [X] Visual check of dev server + - [X] Example functionality check + - [X] code manual lint + +- [X] SocialIcons + - [X] Diff check + - [X] Visual check of dev server + - [X] Example functionality check + - [X] code manual lint + +- [ ] Text + - [X] Diff check + - [X] Visual check of dev server + - [X] Example functionality check + - [X] code manual lint + +- [ ] TextArea + - [X] Diff check + - [X] Visual check of dev server + - [X] Example functionality check + - [X] code manual lint + +- [ ] TextInputWithDropdown + - [X] Diff check + - [X] Visual check of dev server + - [X] Example functionality check + - [X] code manual lint + diff --git a/component-checks-Molecules.md b/component-checks-Molecules.md new file mode 100644 index 000000000..630b87d8c --- /dev/null +++ b/component-checks-Molecules.md @@ -0,0 +1,169 @@ + +### Notes: +- styled-components v6 the "&" in "&:hover" is no longer implicit +- removing Axios as conflict + +## Molecules + +- [ ] Accordion + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] ArticleTeaser + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] Banner + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] Box + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] Card + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] CardDs + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] Chip + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] Countdown + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] CTAMultiCard + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] CTASingleCard + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] Descriptor + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] DoubleCopy + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] HeroBanner + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] InfoBanner + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] Lookup + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] PartnerLink + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] Promo + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] QuoteSlice + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] SchoolLookup + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] SearchInput + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] SearchResult + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] ShareButton + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] SimpleSchoolLookup + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] SingleMessage + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] SingleMessageDs + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] Typeahead + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] VideoBanner + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + diff --git a/component-checks-Organisms.md b/component-checks-Organisms.md new file mode 100644 index 000000000..5a0e8f98e --- /dev/null +++ b/component-checks-Organisms.md @@ -0,0 +1,91 @@ + +### Notes: +- styled-components v6 the "&" in "&:hover" is no longer implicit +- removing Axios as conflict + +## Organisms + +- [ ] CookieBanner + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] Donate + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] DonateBanner + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] DynamicGallery + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] EmailSignUpForm + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] Footer + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] FooterNew + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] Header + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] Header2025 + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] ImpactSlider + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] MarketingPreferencesDSForm + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] Membership + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] RichtextCarousel + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + +- [ ] WYMDCarousel + - [ ] Diff check + - [ ] Visual check of dev server + - [ ] Example functionality check + - [ ] code manual lint + diff --git a/index.html b/index.html new file mode 100644 index 000000000..9ffc7a842 --- /dev/null +++ b/index.html @@ -0,0 +1,12 @@ + + + + + + Component Library + + +
+ + + diff --git a/netlify.toml b/netlify.toml new file mode 100644 index 000000000..6297f7a94 --- /dev/null +++ b/netlify.toml @@ -0,0 +1,6 @@ +[build] + command = "yarn build:preview" + publish = "dist" + +[build.environment] + NODE_VERSION = "18" diff --git a/package.json b/package.json index 29a983c99..2e4cc593d 100644 --- a/package.json +++ b/package.json @@ -2,10 +2,19 @@ "name": "@comicrelief/component-library", "author": "Comic Relief Engineering Team", "version": "0.0.0-see.readme.for.semantic.release.process", - "main": "dist/index.js", + "main": "dist/index.cjs.js", + "module": "dist/index.es.js", + "files": [ + "dist" + ], "license": "ISC", + "repository": { + "type": "git", + "url": "https://github.com/comicrelief/component-library.git" + }, "jest": { "verbose": true, + "testEnvironment": "jsdom", "testPathIgnorePatterns": [ "/playwright/", "/dist/", @@ -16,93 +25,76 @@ "^axios$": "axios/dist/node/axios.cjs" } }, - "module": "dist/index.js", - "repository": { - "type": "git", - "url": "https://github.com/comicrelief/component-library.git" + "scripts": { + "dev": "vite", + "build": "vite build", + "build:preview": "vite build --config vite.preview.config.mjs", + "preview": "vite preview", + "test:unit": "jest", + "test:unit:update": "jest -u", + "serve:preview": "vite preview --config vite.preview.config.mjs --port 4173", + "test:e2e": "playwright test --project=chromium", + "test:e2e--h": "playwright test --project=chromium --headed", + "test:e2e:ci": "playwright test --project=chromium", + "test:e2e:local": "playwright test --project=chromium; yarn playwright show-report", + "test:e2e:mac": "playwright test --project=chromium; yarn playwright show-report", + "test:e2e:mac:atoms": "playwright test playwright/components/atoms --project=chromium; yarn playwright show-report", + "test:e2e:mac:molecules": "playwright test playwright/components/molecules --project=chromium; yarn playwright show-report", + "test:e2e:mac:organisms": "playwright test playwright/components/organisms --project=chromium; yarn playwright show-report", + "test:e2e:mac:organisms:impactSlider": "playwright test playwright/components/organisms/impactSlider.spec.js --project=chromium; yarn playwright show-report", + "lint": "eslint src", + "lint-fix": "yarn lint --fix" + }, + "peerDependencies": { + "react": ">=18", + "react-dom": ">=18", + "styled-components": ">=6" }, "dependencies": { - "@babel/cli": "^7.21.5", "@hookform/resolvers": "^3.9.0", "@splidejs/react-splide": "^0.7.12", - "axios": "^1.7.2", - "babel-plugin-import": "^1.13.8", + "axios": "^1.7.7", "lazysizes": "^5.3.2", - "lodash": "^4.17.11", - "moment": "^2.29.4", + "lodash": "^4.17.21", + "moment": "^2.30.1", "prop-types": "^15.8.1", - "pure-react-carousel": "1.30.1", - "react": "^17.0.2", - "react-canvas-confetti": "^1.4.0", + "pure-react-carousel": "^1.30.1", + "react-canvas-confetti": "^2.0.7", "react-currency-format": "^1.1.0", - "react-dom": "^17.0.2", - "react-hook-form": "^7.52.1", + "react-hook-form": "^7.53.2", "react-modal": "^3.16.1", "react-range-slider-input": "^3.0.7", - "react-responsive": "^9.0.2", - "react-scripts": "4.0.3", - "react-spinners": "^0.11.0", + "react-responsive": "^10.0.0", + "react-spinners": "^0.14.1", "react-uid": "^2.3.3", - "styled-components": "^5.3.11", "youtube-player": "^5.6.0", "yup": "^1.4.0" }, - "resolutions": { - "react-scripts/workbox-webpack-plugin/workbox-build/@surma/rollup-plugin-off-main-thread/ejs": "3.1.10", - "loader-utils": "2.0.3", - "unset-value": "2.0.1", - "shell-quote": "1.7.3", - "ansi-html": "0.0.9", - "semver": "7.5.2", - "braces": "3.0.3", - "node-forge": "1.3.2", - "nth-check": "2.0.1" - }, - "scripts": { - "build": "rm -rf dist && NODE_ENV=production babel src --out-dir dist --copy-files --ignore __tests__,spec.js,test.js", - "test:unit": "yarn run jest", - "test:unit:update": "yarn jest -u", - "styleguide": "cross-env FAST_REFRESH=false styleguidist server", - "styleguide:build": "styleguidist build", - "test:e2e": "playwright test --project=chromium", - "test:e2e--h": "playwright test --project=chromium --headed", - "test:e2e:ci": "NODE_ENV=development; start-server-and-test styleguide http://localhost:6060 test:e2e", - "test:e2e:local": "export NODE_ENV=development; start-server-and-test styleguide http://localhost:6060 test:e2e", - "lint": "eslint src", - "lint-fix": "yarn lint --fix", - "build-pr": "rm -rf dist && NODE_ENV=development BABEL_ENV=development yarn babel src --out-dir dist --copy-files --ignore __tests__,spec.js,test.js", - "postinstall": "yarn build-pr" - }, - "browserslist": { - "production": [ - ">0.2%", - "not dead", - "not op_mini all" - ], - "development": [ - "last 1 chrome version", - "last 1 firefox version", - "last 1 safari version" - ] - }, "devDependencies": { - "@babel/plugin-proposal-private-property-in-object": "^7.21.11", + "@babel/core": "^7.24.0", + "@babel/preset-env": "^7.24.0", + "@babel/preset-react": "^7.24.0", "@playwright/test": "^1.38.1", - "cross-env": "^7.0.3", - "ejs": "^3.1.10", + "@vitejs/plugin-react": "^4.3.1", + "babel-jest": "^29.7.0", + "babel-plugin-styled-components": "^2.1.4", + "dotenv": "^17.4.2", "eslint": "^7.32.0", "eslint-config-airbnb": "^18.2.0", "eslint-plugin-import": "^2.27.5", "eslint-plugin-jsx-a11y": "^6.7.1", "eslint-plugin-react": "^7.32.2", "eslint-plugin-react-hooks": "^4.6.0", - "jest": "^26.1.0", - "jest-styled-components": "^7.1.1", - "npm-run-all": "^4.1.5", - "prettier": "^2.8.8", - "react-styleguidist": "^11.1.7", - "react-test-renderer": "^17.0.2", + "jest": "^29.7.0", + "jest-environment-jsdom": "^29.7.0", + "jest-styled-components": "^7.4.0", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "react-markdown": "^10.1.0", + "react-test-renderer": "^18.3.1", "semantic-release": "^17.4.6", - "start-server-and-test": "^2.0.4" + "styled-components": "^6.1.13", + "vite": "^5.4.10", + "vite-plugin-dts": "^4.3.0" } } diff --git a/playwright.config.js b/playwright.config.js index 7b157c890..666e6d9eb 100644 --- a/playwright.config.js +++ b/playwright.config.js @@ -23,9 +23,11 @@ module.exports = defineConfig({ }, reporter: [ ['list'], - ['html', { open: 'never' }] + ['html', { open: 'never' }], + ['json', { outputFile: '/tmp/pw-progress.json' }] ], use: { + baseURL: 'http://localhost:4173', actionTimeout: 0, /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: 'on-first-retry' @@ -37,6 +39,7 @@ module.exports = defineConfig({ name: 'chromium', use: { ...devices['Desktop Chrome'], + channel: process.platform === 'darwin' ? 'chrome' : undefined, viewport: { // Match our widest nav: width: 1300, @@ -48,9 +51,9 @@ module.exports = defineConfig({ /* Run your local dev server before starting the tests */ webServer: { - command: 'yarn styleguide', - port: '6060', + command: 'yarn build:preview && yarn serve:preview', + url: 'http://localhost:4173', timeout: 120000, - reuseExistingServer: true + reuseExistingServer: !process.env.CI } }); diff --git a/playwright/components/atoms/input.spec.js b/playwright/components/atoms/input.spec.js index 1a4470017..e7398f73c 100644 --- a/playwright/components/atoms/input.spec.js +++ b/playwright/components/atoms/input.spec.js @@ -39,7 +39,7 @@ test.describe('input component', () => { await page.locator('#input-example-2').type('This is test input text'); // error message should be visible - await expect(page.locator('[data-preview="Input"] > div > label > span[data-test="error-message"]')).toBeVisible(); + await expect(page.locator('label[for="input-example-2"] span[data-test="error-message"]')).toBeVisible(); await page.close(); }); @@ -57,7 +57,7 @@ test.describe('input component', () => { const nameAttribute = await inputElement.getAttribute('name'); // Verify the 'name' attribute - expect(nameAttribute).toBe('fullname'); + expect(nameAttribute).toBe('fullname3'); await page.locator('#input-example-3').type('This is test input text'); @@ -77,7 +77,7 @@ test.describe('input component', () => { const nameAttribute = await inputElement.getAttribute('name'); // Verify the 'name' attribute - expect(nameAttribute).toBe('fullname'); + expect(nameAttribute).toBe('fullname4'); await page.locator('#input-example-4').type('This is test input text'); @@ -97,7 +97,7 @@ test.describe('input component', () => { const nameAttribute = await inputElement.getAttribute('name'); // Verify the 'name' attribute - expect(nameAttribute).toBe('fullname'); + expect(nameAttribute).toBe('fullname5'); await page.locator('#input-example-5').type('This is test input text'); diff --git a/playwright/components/atoms/label.spec.js b/playwright/components/atoms/label.spec.js index e86ad355e..b01371348 100644 --- a/playwright/components/atoms/label.spec.js +++ b/playwright/components/atoms/label.spec.js @@ -6,7 +6,7 @@ test.describe('label component', () => { await page.goto('/#label'); // select dropdown menu component-1 should be visible - const specificElement = page.locator('[data-testid="Label-example-0"]'); + const specificElement = page.locator('[data-testid="Label-example-1"]'); await expect(specificElement).toBeVisible(); await page.locator('input[name="field-wrapper-test"]').type('This is test text'); diff --git a/playwright/components/atoms/link.spec.js b/playwright/components/atoms/link.spec.js index 3ca646526..9f7f980c9 100644 --- a/playwright/components/atoms/link.spec.js +++ b/playwright/components/atoms/link.spec.js @@ -6,12 +6,12 @@ test.describe('link component', () => { await page.goto('/#link'); // select dropdown menu component-1 should be visible - const specificElement = page.locator('[data-testid="Link-example-0"]'); + const specificElement = page.locator('[data-testid="Link-example-1"]'); await expect(specificElement).toBeVisible(); const [popup] = await Promise.all([ context.waitForEvent('page'), // Wait for a new page (popup) - page.click('[data-preview="Link"] div:nth-child(1) > a'), // Click the link + page.click('[data-testid="Link-example-1"] a[href="#anchor"]:first-of-type'), // Click the link ]); // Check if the popup is a new window @@ -27,15 +27,15 @@ test.describe('link component', () => { await page.goto('/#link'); // select dropdown menu component-1 should be visible - const specificElement = page.locator('[data-testid="Link-example-0"]'); + const specificElement = page.locator('[data-testid="Link-example-1"]'); await expect(specificElement).toBeVisible(); // link standard icon should be visible - await expect(page.locator('[data-preview="Link"] div:nth-child(2) > a > span[type="standard"]')).toBeVisible(); + await expect(page.locator('[data-testid="Link-example-1"] a span[type="standard"]')).toBeVisible(); const [popup] = await Promise.all([ context.waitForEvent('page'), // Wait for a new page (popup) - page.click('[data-preview="Link"] div:nth-child(2) > a'), // Click the link + page.click('[data-testid="Link-example-1"] a:has(span[type="standard"])'), // Click the link ]); // Check if the popup is a new window diff --git a/playwright/components/molecules/accordian.spec.js b/playwright/components/molecules/accordian.spec.js index 2ad3985f9..826c3463b 100644 --- a/playwright/components/molecules/accordian.spec.js +++ b/playwright/components/molecules/accordian.spec.js @@ -7,12 +7,12 @@ test.describe('accordian component', () => { // accordian elements should be visible await expect(page.locator('[data-testid="Accordion-example-1"]')).toBeVisible(); await expect(page.locator('[data-testid="Accordion-example-1"] [data-preview="Accordion"]')).toBeVisible(); - // dropdown svg icon should be visible - await expect(page.locator('[data-testid="Accordion-example-1"] [data-preview="Accordion"] img')).toBeVisible(); + // dropdown icon should be visible + await expect(page.locator('[data-testid="Accordion-example-1"] [data-preview="Accordion"] img').first()).toBeVisible(); // clicking the accordian should show the paragraph - await page.locator('[data-testid="Accordion-example-1"] [data-preview="Accordion"] img').click(); - await expect(page.locator('[data-testid="Accordion-example-1"] [data-preview="Accordion"] p')).toBeVisible(); + await page.locator('[data-testid="Accordion-example-1"] [data-preview="Accordion"] img').first().click(); + await expect(page.locator('[data-testid="Accordion-example-1"] [data-preview="Accordion"] p').first()).toBeVisible(); await page.close(); }); diff --git a/playwright/components/molecules/searchInput.spec.js b/playwright/components/molecules/searchInput.spec.js index 3deb0dffa..dc8292baa 100644 --- a/playwright/components/molecules/searchInput.spec.js +++ b/playwright/components/molecules/searchInput.spec.js @@ -8,13 +8,13 @@ test.describe('search input component', () => { await expect(page.locator('[data-testid="SearchInput-example-1"]')).toBeVisible(); await expect(page.locator('[data-preview="SearchInput"]')).toBeVisible(); - const inputElement = page.locator('#school-lookup'); + const inputElement = page.locator('#search'); // Get the 'placeholder' attribute const placeholderAttribute = await inputElement.getAttribute('placeholder'); // Verify the 'placeholder' attribute - expect(placeholderAttribute).toBe('Type to start search'); + expect(placeholderAttribute).toBe('Search...'); await page.locator('#search').type('Red Nose Day'); diff --git a/playwright/components/molecules/shareButton.spec.js b/playwright/components/molecules/shareButton.spec.js index 433283ae5..59d0c206b 100644 --- a/playwright/components/molecules/shareButton.spec.js +++ b/playwright/components/molecules/shareButton.spec.js @@ -6,12 +6,12 @@ test.describe('share button component', () => { await page.goto('/#sharebutton'); // accordian elements should be visible - await expect(page.locator('[data-testid="ShareButton-example-0"]')).toBeVisible(); + await expect(page.locator('[data-testid="ShareButton-example-1"]')).toBeVisible(); await expect(page.locator('[data-preview="ShareButton"]')).toBeVisible(); - await expect(page.locator('[data-preview="ShareButton"] > div > div > div:nth-child(1) > ul > li:nth-child(1) > a > img')).toBeVisible(); + await expect(page.locator('[data-testid="ShareButton-example-1"] a[title="Share on Facebook"] img').first()).toBeVisible(); - const facebookShareButton = page.locator('[data-preview="ShareButton"] > div > div > div:nth-child(1) > ul > li:nth-child(1) > a'); + const facebookShareButton = page.locator('[data-testid="ShareButton-example-1"] a[title="Share on Facebook"]').first(); // Get the 'title' attribute const placeholderAttribute = await facebookShareButton.getAttribute('title'); @@ -19,7 +19,7 @@ test.describe('share button component', () => { // Verify the 'title' attribute expect(placeholderAttribute).toBe('Share on Facebook'); - const twitterShareButton = page.locator('[data-preview="ShareButton"] > div > div > div:nth-child(1) > ul > li:nth-child(2) > a'); + const twitterShareButton = page.locator('[data-testid="ShareButton-example-1"] a[title="Share on Twitter"]').first(); // Get the 'title' attribute const twiiterPlaceholderAttribute = await twitterShareButton.getAttribute('title'); diff --git a/playwright/components/molecules/simpleSchoolLookUp.spec.js b/playwright/components/molecules/simpleSchoolLookUp.spec.js index ec5ce2a32..a8c2226ff 100644 --- a/playwright/components/molecules/simpleSchoolLookUp.spec.js +++ b/playwright/components/molecules/simpleSchoolLookUp.spec.js @@ -2,10 +2,26 @@ const { test, expect } = require('@playwright/test'); test.describe('simple school lookup component', () => { test('simple school lookup', async ({ page, context }) => { + await page.route('**/schools/lookup**', route => { + route.fulfill({ + status: 200, + contentType: 'application/json', + body: JSON.stringify({ + data: { + schools: [ + { name: "St Paul's School", post_code: 'SW13 9JT' }, + { name: "St Paul's Cathedral School", post_code: 'EC4M 8AD' }, + { name: 'EC4M 9AD School', post_code: 'EC4M 9AD' } + ] + } + }) + }); + }); + await page.goto('/#simpleschoollookup'); // simple school lookup elements should be visible - await expect(page.locator('[data-testid="SimpleSchoolLookup-example-0"]')).toBeVisible(); + await expect(page.locator('[data-testid="SimpleSchoolLookup-example-1"]')).toBeVisible(); await expect(page.locator('[data-preview="SimpleSchoolLookup"]')).toBeVisible(); const inputElement = page.locator('#school_lookup'); @@ -18,15 +34,15 @@ test.describe('simple school lookup component', () => { // enter school name and click find address button await page.locator('input#school_lookup').type('St Paul'); - await expect(page.locator('[data-preview="SimpleSchoolLookup"] > div > div > button[type="button"]')).toBeVisible(); - await page.locator('[data-preview="SimpleSchoolLookup"] > div > div > button[type="button"]').click(); + await expect(page.locator('[data-preview="SimpleSchoolLookup"] button[type="button"]')).toBeVisible(); + await page.locator('[data-preview="SimpleSchoolLookup"] button[type="button"]').click(); await expect(page.locator('label[for="school_lookup"] ~ div > ul[role="listbox"]')).toBeVisible(); // clear school name and enter school postcode await page.locator('input#school_lookup').fill(''); await page.locator('input#school_lookup').fill('EC4M 9AD'); - await expect(page.locator('[data-preview="SimpleSchoolLookup"] > div > div > button[type="button"]')).toBeVisible(); - await page.locator('[data-preview="SimpleSchoolLookup"] > div > div > button[type="button"]').click(); + await expect(page.locator('[data-preview="SimpleSchoolLookup"] button[type="button"]')).toBeVisible(); + await page.locator('[data-preview="SimpleSchoolLookup"] button[type="button"]').click(); await expect(page.locator('label[for="school_lookup"] ~ div > ul[role="listbox"]')).toBeVisible(); await page.close(); diff --git a/playwright/components/organisms/dynamicGallery.spec.js b/playwright/components/organisms/dynamicGallery.spec.js index 2c0cd2fd2..35fc9b431 100644 --- a/playwright/components/organisms/dynamicGallery.spec.js +++ b/playwright/components/organisms/dynamicGallery.spec.js @@ -21,85 +21,95 @@ test.describe('dynamic gallery component', () => { }); test('gallery column props', async ({ page }) => { - await page.goto('/#!/DynamicGallery/5'); + await page.goto('/#dynamicgallery'); - // expect three gallery columns - await expect(page.locator('.gallery-column')).toHaveCount(4); + const gallery = page.locator('[data-testid="gallery-customised"]'); + + // expect four gallery columns + await expect(gallery.locator('.gallery-column')).toHaveCount(4); await page.close(); }); // MARK: responsive columns test('responsive gallery columns', async ({ page }) => { - await page.goto('/#!/DynamicGallery/3'); + await page.goto('/#dynamicgallery'); + + const gallery = page.locator('[data-testid="gallery-basic"]'); // expect three gallery columns - await expect(page.locator('.gallery-column')).toHaveCount(3); + await expect(gallery.locator('.gallery-column')).toHaveCount(3); // resize the page to a small width await page.setViewportSize({ width: 700, height: 1000 }); - // expect one gallery column - await expect(page.locator('.gallery-column')).toHaveCount(2); + // expect two gallery columns + await expect(gallery.locator('.gallery-column')).toHaveCount(2); // resize the page to a medium width await page.setViewportSize({ width: 320, height: 1000 }); // expect one gallery column - await expect(page.locator('.gallery-column')).toHaveCount(1); + await expect(gallery.locator('.gallery-column')).toHaveCount(1); await page.close(); }); // MARK: chunk mode test('chunk mode test', async ({ page }) => { - await page.goto('/#!/DynamicGallery/3'); + await page.goto('/#dynamicgallery'); + + const gallery = page.locator('[data-testid="gallery-basic"]'); // expect 25 images to be visible - await expect(page.locator('.gallery-node')).toHaveCount(25); + await expect(gallery.locator('.gallery-node')).toHaveCount(25); // find the "load more" button and click it - await page.locator('button:has-text("Show more")').click(); + await gallery.locator('button:has-text("Show more")').click(); // expect 50 images to be visible - await expect(page.locator('.gallery-node')).toHaveCount(50); + await expect(gallery.locator('.gallery-node')).toHaveCount(50); // expect the "load more" button to be hidden - await expect(page.locator('button:has-text("Show more")')).toBeHidden(); + await expect(gallery.locator('button:has-text("Show more")')).toBeHidden(); await page.close(); }); // MARK: non-chunk mode test('non-chunk mode test', async ({ page }) => { - await page.goto('/#!/DynamicGallery/5'); + await page.goto('/#dynamicgallery'); + + const gallery = page.locator('[data-testid="gallery-customised"]'); // expect all 30 images to be visible - await expect(page.locator('.gallery-node')).toHaveCount(30); + await expect(gallery.locator('.gallery-node')).toHaveCount(30); // expect the "load more" button to be hidden - await expect(page.locator('button:has-text("Show more")')).toBeHidden(); + await expect(gallery.locator('button:has-text("Show more")')).toBeHidden(); await page.close(); }); // MARK: tabbing test('gallery tabbing', async ({ page }) => { - await page.goto('/#!/DynamicGallery/3'); + await page.goto('/#dynamicgallery'); + + const gallery = page.locator('[data-testid="gallery-basic"]'); // focus the first gallery node - await page.locator('.gallery-node').first().focus(); + await gallery.locator('.gallery-node').first().focus(); await page.waitForTimeout(3000); // first tab should focus the first node in the first column - const firstNode = page.locator('.gallery-column').first().locator('.gallery-node').first(); + const firstNode = gallery.locator('.gallery-column').first().locator('.gallery-node').first(); await firstNode.focus(); await expect(firstNode).toBeFocused(); // tab to the first node in the second column await page.keyboard.press('Tab'); - const secondNode = page.locator('.gallery-column').nth(1).locator('.gallery-node').first(); + const secondNode = gallery.locator('.gallery-column').nth(1).locator('.gallery-node').first(); await expect(secondNode).toBeFocused(); // tab back to the first node in the first column @@ -111,19 +121,21 @@ test.describe('dynamic gallery component', () => { // MARK: tabbing out test('gallery tabbing should allow tabbing out of the gallery', async ({ page }) => { - await page.goto('/#!/DynamicGallery/5'); + await page.goto('/#dynamicgallery'); await page.waitForTimeout(3000); - // focus the first gallery node - const galleryNodes = await page.locator('.gallery-node').all(); - await page.locator(`[data-node-index="${galleryNodes.length - 1}"]`).focus(); + const gallery = page.locator('[data-testid="gallery-customised"]'); + + // focus the last gallery node + const galleryNodes = await gallery.locator('.gallery-node').all(); + await gallery.locator(`[data-node-index="${galleryNodes.length - 1}"]`).focus(); // press tab await page.keyboard.press('Tab'); - const galleryContainer = page.locator('.gallery-container'); + const galleryContainer = gallery.locator('.gallery-container'); - // asset that the focus has moved outside the gallery + // assert that the focus has moved outside the gallery expect( await galleryContainer.evaluate( el => !el.contains(document.activeElement) @@ -134,9 +146,9 @@ test.describe('dynamic gallery component', () => { // MARK: colours test('custom page background and text colour', async ({ page }) => { - await page.goto('/#!/DynamicGallery/5'); + await page.goto('/#dynamicgallery'); - const galleryContainer = page.locator('.gallery-container'); + const galleryContainer = page.locator('[data-testid="gallery-customised"] .gallery-container'); const backgroundColor = await galleryContainer.evaluate(el => window.getComputedStyle(el).getPropertyValue('background-color')); expect(backgroundColor).toBe(hexToRgb('#0565D1')); @@ -149,65 +161,71 @@ test.describe('dynamic gallery component', () => { // MARK: lightbox mode test('check lightbox mode', async ({ page }) => { - await page.goto('/#!/DynamicGallery/3'); + await page.goto('/#dynamicgallery'); + + const gallery = page.locator('[data-testid="gallery-basic"]'); // find the first gallery node - const galleryNode = page.locator('.gallery-node').first(); + const galleryNode = gallery.locator('.gallery-node').first(); // click it await galleryNode.click(); // expect the lightbox to be visible - await expect(page.locator('dialog')).toBeVisible(); + await expect(gallery.locator('dialog')).toBeVisible(); await page.waitForTimeout(1000); await page.keyboard.press('Escape'); - await expect(page.locator('dialog')).toBeHidden(); + await expect(gallery.locator('dialog')).toBeHidden(); // focus the gallery node and press enter await galleryNode.focus(); await page.keyboard.press('Enter'); // expect the lightbox to be visible - await expect(page.locator('dialog')).toBeVisible(); + await expect(gallery.locator('dialog')).toBeVisible(); await page.close(); }); // MARK: lightbox focus test('check lightbox auto-focus', async ({ page }) => { - await page.goto('/#!/DynamicGallery/3'); + await page.goto('/#dynamicgallery'); + + const gallery = page.locator('[data-testid="gallery-basic"]'); // find the first gallery node - const galleryNode = page.locator('.gallery-node').first(); + const galleryNode = gallery.locator('.gallery-node').first(); // click it await galleryNode.click(); // the close button should not be focused after opening the lightbox with the mouse - await expect(page.locator('.close-button')).not.toBeFocused(); + await expect(gallery.locator('.close-button')).not.toBeFocused(); await page.keyboard.press('Escape'); // the close button should be focused after opening the lightbox with the keyboard await galleryNode.focus(); await page.keyboard.press('Enter'); - await expect(page.locator('.close-button')).toBeFocused(); + await expect(gallery.locator('.close-button')).toBeFocused(); await page.close(); }); // MARK: lightbox navigation test('lightbox navigation', async ({ page }) => { - await page.goto('/#!/DynamicGallery/3'); + await page.goto('/#dynamicgallery'); + + const gallery = page.locator('[data-testid="gallery-basic"]'); // find the first gallery node - const galleryNode = page.locator('.gallery-node').first(); + const galleryNode = gallery.locator('.gallery-node').first(); // click it await galleryNode.click(); // expect the lightbox and caption to be visible - await expect(page.locator('dialog')).toBeVisible(); + await expect(gallery.locator('dialog')).toBeVisible(); await expect(page.getByText('Lightbox: This is the body for image 0')).toBeVisible(); await page.waitForTimeout(1000); @@ -221,42 +239,46 @@ test.describe('dynamic gallery component', () => { // MARK: lightbox pointer close test('lightbox pointer close', async ({ page }) => { - await page.goto('/#!/DynamicGallery/3'); + await page.goto('/#dynamicgallery'); + + const gallery = page.locator('[data-testid="gallery-basic"]'); // find the first gallery node - const galleryNode = page.locator('.gallery-node').first(); + const galleryNode = gallery.locator('.gallery-node').first(); // click it await galleryNode.click(); // click the close button - await page.locator('.close-button').click(); + await gallery.locator('.close-button').click(); // expect the lightbox to be hidden - await expect(page.locator('dialog')).toBeHidden(); + await expect(gallery.locator('dialog')).toBeHidden(); await page.close(); }); // MARK: non-lightbox mode test('check non-lightbox mode', async ({ page }) => { - await page.goto('/#!/DynamicGallery/5'); + await page.goto('/#dynamicgallery'); + + const gallery = page.locator('[data-testid="gallery-customised"]'); // find the first gallery node - const galleryNode = page.locator('.gallery-node').first(); + const galleryNode = gallery.locator('.gallery-node').first(); // click it await galleryNode.click(); // expect the lightbox to be hidden - await expect(page.locator('dialog')).toBeHidden(); + await expect(gallery.locator('dialog')).toBeHidden(); // focus the gallery node and press enter await galleryNode.focus(); await page.keyboard.press('Enter'); // expect the lightbox to be hidden - await expect(page.locator('dialog')).toBeHidden(); + await expect(gallery.locator('dialog')).toBeHidden(); await page.close(); }); diff --git a/playwright/components/organisms/emailSignUpForm.spec.js b/playwright/components/organisms/emailSignUpForm.spec.js index b0de6e675..565309d5a 100644 --- a/playwright/components/organisms/emailSignUpForm.spec.js +++ b/playwright/components/organisms/emailSignUpForm.spec.js @@ -93,12 +93,15 @@ test.describe('Email Signup Form component', () => { // enter valid inputs should not show error messages await page.locator('[data-testid="EmailSignUpForm-example-1"] #first-name').fill(''); await page.locator('[data-testid="EmailSignUpForm-example-1"] #first-name').type('test firstname'); + await page.evaluate(sel => document.querySelector(sel).dispatchEvent(new FocusEvent('focusout', { bubbles: true })), '[data-testid="EmailSignUpForm-example-1"] #first-name'); await page.locator('[data-testid="EmailSignUpForm-example-1"] #last-name').fill(''); await page.locator('[data-testid="EmailSignUpForm-example-1"] #last-name').type('test lastname'); + await page.evaluate(sel => document.querySelector(sel).dispatchEvent(new FocusEvent('focusout', { bubbles: true })), '[data-testid="EmailSignUpForm-example-1"] #last-name'); await page.locator('[data-testid="EmailSignUpForm-example-1"] #email').fill(''); // clear the email field await page.locator('[data-testid="EmailSignUpForm-example-1"] #email').type('email-signup@email.sls.comicrelief.com'); + await page.evaluate(sel => document.querySelector(sel).dispatchEvent(new FocusEvent('focusout', { bubbles: true })), '[data-testid="EmailSignUpForm-example-1"] #email'); // submit the ESU form await page.locator('[data-testid="EmailSignUpForm-example-1"] button[type="submit"]').click(); diff --git a/playwright/components/organisms/footer.spec.js b/playwright/components/organisms/footer.spec.js index 833b48031..49bff6fd9 100644 --- a/playwright/components/organisms/footer.spec.js +++ b/playwright/components/organisms/footer.spec.js @@ -6,16 +6,16 @@ test.describe('footer component', () => { await expect(page.locator('[data-testid="Footer-example-1"]')).toBeVisible(); // footer social icons should be visible - await expect(page.locator('[data-preview="Footer"] > div > div:nth-child(2) > footer[role="banner"] [title="Check out our Facebook page"]')).toBeVisible(); - await expect(page.locator('[data-preview="Footer"] > div > div:nth-child(2) > footer[role="banner"] [title="Check out our Instagram account"]')).toBeVisible(); - await expect(page.locator('[data-preview="Footer"] > div > div:nth-child(2) > footer[role="banner"] [title="Check out our Twitter account"]')).toBeVisible(); - await expect(page.locator('[data-preview="Footer"] > div > div:nth-child(2) > footer[role="banner"] [title="Check out our YouTube channel"]')).toBeVisible(); + await expect(page.locator('[data-testid="Footer-example-1"] footer[role="banner"] [title="Check out our Facebook page"]')).toBeVisible(); + await expect(page.locator('[data-testid="Footer-example-1"] footer[role="banner"] [title="Check out our Instagram account"]')).toBeVisible(); + await expect(page.locator('[data-testid="Footer-example-1"] footer[role="banner"] [title="Check out our Twitter account"]')).toBeVisible(); + await expect(page.locator('[data-testid="Footer-example-1"] footer[role="banner"] [title="Check out our YouTube channel"]')).toBeVisible(); // CR logo in the footer should be visible - await expect(page.locator('[data-preview="Footer"] > div > div:nth-child(2) > footer[role="banner"] [title="Go to Comic Relief homepage"]')).toBeVisible(); + await expect(page.locator('[data-testid="Footer-example-1"] footer[role="banner"] [title="Go to Comic Relief homepage"]')).toBeVisible(); // footer menu should be visible - await expect(page.locator('[data-preview="Footer"] > div > div:nth-child(2) > footer[role="banner"] [aria-label="main-menu"]')).toBeVisible(); + await expect(page.locator('[data-testid="Footer-example-1"] footer[role="banner"] [aria-label="main-menu"]')).toBeVisible(); await page.close(); }); @@ -23,18 +23,18 @@ test.describe('footer component', () => { test('Overrides allowList functionality', async ({ page }) => { await page.goto('/#footer'); - await expect(page.locator('[data-testid="Footer-example-1"]')).toBeVisible(); + await expect(page.locator('[data-testid="Footer-example-3"]')).toBeVisible(); // footer social icons should be visible - await expect(page.locator('[data-preview="Footer"] > div > div:nth-child(4) > footer[role="banner"] [title="Check out our Facebook page"]')).toBeVisible(); - await expect(page.locator('[data-preview="Footer"] > div > div:nth-child(4) > footer[role="banner"] [title="Check out our Instagram account"]')).toBeVisible(); - await expect(page.locator('[data-preview="Footer"] > div > div:nth-child(4) > footer[role="banner"] [title="Check out our Twitter account"]')).toBeVisible(); - await expect(page.locator('[data-preview="Footer"] > div > div:nth-child(4) > footer[role="banner"] [title="Check out our YouTube channel"]')).toBeVisible(); + await expect(page.locator('[data-testid="Footer-example-3"] footer[role="banner"] [title="Check out our Facebook page"]')).toBeVisible(); + await expect(page.locator('[data-testid="Footer-example-3"] footer[role="banner"] [title="Check out our Instagram account"]')).toBeVisible(); + await expect(page.locator('[data-testid="Footer-example-3"] footer[role="banner"] [title="Check out our Twitter account"]')).toBeVisible(); + await expect(page.locator('[data-testid="Footer-example-3"] footer[role="banner"] [title="Check out our YouTube channel"]')).toBeVisible(); // CR logo in the footer should be visible - await expect(page.locator('[data-preview="Footer"] > div > div:nth-child(4) > footer[role="banner"] [title="Go to Comic Relief homepage"]')).toBeVisible(); + await expect(page.locator('[data-testid="Footer-example-3"] footer[role="banner"] [title="Go to Comic Relief homepage"]')).toBeVisible(); // footer menu should be visible - await expect(page.locator('[data-preview="Footer"] > div > div:nth-child(4) > footer[role="banner"] [aria-label="main-menu"]')).toBeVisible(); + await expect(page.locator('[data-testid="Footer-example-3"] footer[role="banner"] [aria-label="main-menu"]')).toBeVisible(); await page.close(); }); @@ -42,22 +42,22 @@ test.describe('footer component', () => { test('additional legal line footer', async ({ page }) => { await page.goto('/#footer'); - await expect(page.locator('[data-testid="Footer-example-1"]')).toBeVisible(); + await expect(page.locator('[data-testid="Footer-example-5"]')).toBeVisible(); // legal line to the top of the footer should be present - await expect(page.locator('[data-preview="Footer"] > div > div:nth-child(6) > footer[role="banner"] > div > p')).toContainText('CHICKEN RUN: DAWN OF THE NUGGET ™/ © Aardman. Netflix ™/© Netflix. Used with permission/Wallace & Gromit Ltd. All rights reserved/ Shaun the Sheep © & TM /Morph ©/TM Aardman Animations Ltd. All rights reserved.'); + await expect(page.locator('[data-testid="Footer-example-5"] footer[role="banner"] > div > p')).toContainText('CHICKEN RUN: DAWN OF THE NUGGET ™/ © Aardman. Netflix ™/© Netflix. Used with permission/Wallace & Gromit Ltd. All rights reserved/ Shaun the Sheep © & TM /Morph ©/TM Aardman Animations Ltd. All rights reserved.'); // footer social icons should be visible - await expect(page.locator('[data-preview="Footer"] > div > div:nth-child(4) > footer[role="banner"] [title="Check out our Facebook page"]')).toBeVisible(); - await expect(page.locator('[data-preview="Footer"] > div > div:nth-child(6) > footer[role="banner"] [title="Check out our Instagram account"]')).toBeVisible(); - await expect(page.locator('[data-preview="Footer"] > div > div:nth-child(6) > footer[role="banner"] [title="Check out our Twitter account"]')).toBeVisible(); - await expect(page.locator('[data-preview="Footer"] > div > div:nth-child(6) > footer[role="banner"] [title="Check out our YouTube channel"]')).toBeVisible(); + await expect(page.locator('[data-testid="Footer-example-5"] footer[role="banner"] [title="Check out our Facebook page"]')).toBeVisible(); + await expect(page.locator('[data-testid="Footer-example-5"] footer[role="banner"] [title="Check out our Instagram account"]')).toBeVisible(); + await expect(page.locator('[data-testid="Footer-example-5"] footer[role="banner"] [title="Check out our Twitter account"]')).toBeVisible(); + await expect(page.locator('[data-testid="Footer-example-5"] footer[role="banner"] [title="Check out our YouTube channel"]')).toBeVisible(); // CR logo in the footer should be visible - await expect(page.locator('[data-preview="Footer"] > div > div:nth-child(6) > footer[role="banner"] [title="Go to Comic Relief homepage"]')).toBeVisible(); + await expect(page.locator('[data-testid="Footer-example-5"] footer[role="banner"] [title="Go to Comic Relief homepage"]')).toBeVisible(); // footer menu should be visible - await expect(page.locator('[data-preview="Footer"] > div > div:nth-child(6) > footer[role="banner"] [aria-label="main-menu"]')).toBeVisible(); + await expect(page.locator('[data-testid="Footer-example-5"] footer[role="banner"] [aria-label="main-menu"]')).toBeVisible(); await page.close(); }); diff --git a/playwright/components/organisms/impactSlider.spec.js b/playwright/components/organisms/impactSlider.spec.js index 015e5ab99..08fdc9971 100644 --- a/playwright/components/organisms/impactSlider.spec.js +++ b/playwright/components/organisms/impactSlider.spec.js @@ -1,42 +1,34 @@ const { test, expect } = require('@playwright/test'); +const SLIDER_MIN = 5; +const SLIDER_MAX = 100; + +async function setSliderValue(page, testid, value) { + const slider = page.locator(`[data-testid="${testid}"] #ImpactSlider`); + await slider.scrollIntoViewIfNeeded(); + const box = await slider.boundingBox(); + if (box) { + const fraction = Math.min((value - SLIDER_MIN) / (SLIDER_MAX - SLIDER_MIN), 0.98); + const clickX = box.x + box.width * fraction; + const clickY = box.y + box.height / 2; + await page.mouse.click(clickX, clickY); + } +} + test.describe('impact slider component - 1', () => { test('impact slider - sliding to £70', async ({ page }) => { - await page.goto('/#impactslider'); // Ensure that the slider and its handle are visible await expect(page.locator('[data-testid="ImpactSlider-example-1"]')).toBeVisible(); await expect(page.locator('[data-testid="ImpactSlider-example-1"] #ImpactSlider > div:nth-child(4)')).toBeVisible(); - // slider selector - const sliderSelector = '[data-testid="ImpactSlider-example-1"] #ImpactSlider'; - const slider = await page.$(sliderSelector); - const moneyBuyElement = page.locator('[data-testid="ImpactSlider-example-1"] [data-testid="impact-slider--moneybuy-1"]'); - const moneyBuyText = await moneyBuyElement.innerText(); - console.log('Target initially: ', moneyBuyText); - - if (slider) { - // Get the bounding box of the slider - let sliderBound = await slider.boundingBox(); - - // Get the target position for the mouse move to a donation of £70 - const targetPosition = sliderBound.width * (70 / 100); + console.log('Target initially: ', await moneyBuyElement.innerText()); - // Perform mouse actions to simulate dragging the slider handle - await page.mouse.move(sliderBound.x, sliderBound.y + sliderBound.height / 2); - await page.mouse.down(); + await setSliderValue(page, 'ImpactSlider-example-1', 70); - while (sliderBound.width * (parseFloat(await moneyBuyElement.innerText()) / 100) !== targetPosition) { - await page.mouse.move(sliderBound.x + targetPosition, sliderBound.y + sliderBound.height / 2); - sliderBound = await slider.boundingBox(); - } - - await page.mouse.up(); - } - - await expect(page.locator('[data-testid="ImpactSlider-example-1"] > [data-preview="ImpactSlider"] > div > div > div > p')).toContainText('A donation of £70 could help pay for:'); + await expect(page.locator('[data-testid="ImpactSlider-example-1"] > [data-preview="ImpactSlider"] > div > div > div > div > p')).toContainText('A donation of £70 could help pay for:'); await expect(page.locator('[data-testid="ImpactSlider-example-1"] [data-testid="impact-slider--moneybuy-1"] [data-testid="moneybuy-amount"]')).toContainText('70'); await expect(page.locator('[data-testid="ImpactSlider-example-1"] [data-testid="impact-slider--moneybuy-2"] [data-testid="moneybuy-amount"]')).toContainText('7'); await expect(page.locator('[data-testid="ImpactSlider-example-1"] [data-testid="impact-slider--moneybuy-3"] [data-testid="moneybuy-amount"]')).toContainText('4'); @@ -50,41 +42,18 @@ test.describe('impact slider component - 1', () => { }); test('impact slider - sliding to the maximum amount £100', async ({ page }) => { - await page.goto('/#impactslider'); // Ensure that the slider and its handle are visible await expect(page.locator('[data-testid="ImpactSlider-example-1"]')).toBeVisible(); await expect(page.locator('[data-testid="ImpactSlider-example-1"] #ImpactSlider > div:nth-child(4)')).toBeVisible(); - // slider selector - const sliderSelector = '[data-testid="ImpactSlider-example-1"] #ImpactSlider'; - const slider = await page.$(sliderSelector); - const moneyBuyElement = page.locator('[data-testid="ImpactSlider-example-1"] [data-testid="impact-slider--moneybuy-1"]'); - const moneyBuyText = await moneyBuyElement.innerText(); - console.log('Target initially: ', moneyBuyText); - - if (slider) { - // Get the bounding box of the slider - let sliderBound = await slider.boundingBox(); + console.log('Target initially: ', await moneyBuyElement.innerText()); - // Get the target position for the mouse move to a donation of £100 - const targetPosition = sliderBound.width * (100 / 100); + await setSliderValue(page, 'ImpactSlider-example-1', 100); - // Perform mouse actions to simulate dragging the slider handle - await page.mouse.move(sliderBound.x, sliderBound.y + sliderBound.height / 2); - await page.mouse.down(); - - while (sliderBound.width * (parseFloat(await moneyBuyElement.innerText()) / 100) !== targetPosition) { - await page.mouse.move(sliderBound.x + targetPosition, sliderBound.y + sliderBound.height / 2); - sliderBound = await slider.boundingBox(); - } - - await page.mouse.up(); - } - - await expect(page.locator('[data-testid="ImpactSlider-example-1"] > [data-preview="ImpactSlider"] > div > div > div > p')).toContainText('A donation of £100 could help pay for:'); + await expect(page.locator('[data-testid="ImpactSlider-example-1"] > [data-preview="ImpactSlider"] > div > div > div > div > p')).toContainText('A donation of £100 could help pay for:'); await expect(page.locator('[data-testid="ImpactSlider-example-1"] [data-testid="impact-slider--moneybuy-1"] [data-testid="moneybuy-amount"]')).toContainText('100'); await expect(page.locator('[data-testid="ImpactSlider-example-1"] [data-testid="impact-slider--moneybuy-2"] [data-testid="moneybuy-amount"]')).toContainText('10'); await expect(page.locator('[data-testid="ImpactSlider-example-1"] [data-testid="impact-slider--moneybuy-3"] [data-testid="moneybuy-amount"]')).toContainText('6'); @@ -98,41 +67,18 @@ test.describe('impact slider component - 1', () => { }); test('impact slider - sliding to the minimum amount £25', async ({ page }) => { - await page.goto('/#impactslider'); // Ensure that the slider and its handle are visible await expect(page.locator('[data-testid="ImpactSlider-example-1"]')).toBeVisible(); await expect(page.locator('[data-testid="ImpactSlider-example-1"] #ImpactSlider > div:nth-child(4)')).toBeVisible(); - // slider selector - const sliderSelector = '[data-testid="ImpactSlider-example-1"] #ImpactSlider'; - const slider = await page.$(sliderSelector); - const moneyBuyElement = page.locator('[data-testid="ImpactSlider-example-1"] [data-testid="impact-slider--moneybuy-1"]'); - const moneyBuyText = await moneyBuyElement.innerText(); - console.log('Target initially: ', moneyBuyText); - - if (slider) { - // Get the bounding box of the slider - let sliderBound = await slider.boundingBox(); - - // Get the target position for the mouse move to a donation of £25 - const targetPosition = sliderBound.width * (25 / 100); - - // Perform mouse actions to simulate dragging the slider handle - await page.mouse.move(sliderBound.x, sliderBound.y + sliderBound.height / 2); - await page.mouse.down(); - - while (sliderBound.width * (parseFloat(await moneyBuyElement.innerText()) / 100) !== targetPosition) { - await page.mouse.move(sliderBound.x + targetPosition, sliderBound.y + sliderBound.height / 2); - sliderBound = await slider.boundingBox(); - } + console.log('Target initially: ', await moneyBuyElement.innerText()); - await page.mouse.up(); - } + await setSliderValue(page, 'ImpactSlider-example-1', 25); - await expect(page.locator('[data-testid="ImpactSlider-example-1"] > [data-preview="ImpactSlider"] > div > div > div > p')).toContainText('A donation of £25 could help pay for:'); + await expect(page.locator('[data-testid="ImpactSlider-example-1"] > [data-preview="ImpactSlider"] > div > div > div > div > p')).toContainText('A donation of £25 could help pay for:'); await expect(page.locator('[data-testid="ImpactSlider-example-1"] [data-testid="impact-slider--moneybuy-1"] [data-testid="moneybuy-amount"]')).toContainText('25'); await expect(page.locator('[data-testid="ImpactSlider-example-1"] [data-testid="impact-slider--moneybuy-2"] [data-testid="moneybuy-amount"]')).toContainText('2'); await expect(page.locator('[data-testid="ImpactSlider-example-1"] [data-testid="impact-slider--moneybuy-3"] [data-testid="moneybuy-amount"]')).toContainText('1'); @@ -152,42 +98,14 @@ test.describe('impact slider component - 1', () => { await expect(page.locator('[data-testid="ImpactSlider-example-1"]')).toBeVisible(); await expect(page.locator('[data-testid="ImpactSlider-example-1"] #ImpactSlider > div:nth-child(4)')).toBeVisible(); - const sliderSelector = '[data-testid="ImpactSlider-example-1"] #ImpactSlider'; - const slider = await page.$(sliderSelector); - const moneyBuyElement = page.locator('[data-testid="ImpactSlider-example-1"] [data-testid="impact-slider--moneybuy-1"]'); - const moneyBuyText = await moneyBuyElement.innerText(); - console.log('Target initially: ', moneyBuyText); - - let targetAmountBeforeMoving; - let sliderBound; + console.log('Target initially: ', await moneyBuyElement.innerText()); // drag the slider to the right to increase the amount to £80 - if (slider) { - // Get the bounding box of the slider - sliderBound = await slider.boundingBox(); - - // Get the target position for the mouse move to a donation of £80 - const targetPosition80 = sliderBound.width * (80 / 100); - - // Perform mouse actions to simulate dragging the slider handle to 80 - await page.mouse.move(sliderBound.x, sliderBound.y + sliderBound.height / 2); - await page.mouse.down(); - - while (sliderBound.width * (parseFloat(await moneyBuyElement.innerText()) / 100) !== targetPosition80) { - await page.mouse.move(sliderBound.x + targetPosition80, sliderBound.y + sliderBound.height / 2); - sliderBound = await slider.boundingBox(); - } + await setSliderValue(page, 'ImpactSlider-example-1', 80); + console.log('Slider increased to amount: ', await moneyBuyElement.innerText()); - await page.mouse.up(); - - // Update targetAmountBeforeMoving after the first slider move - targetAmountBeforeMoving = parseFloat(await moneyBuyElement.innerText()); - console.log('Slider increased to amount: ', targetAmountBeforeMoving); - } - - // Validate that the slider is at £80 - await expect(page.locator('[data-testid="ImpactSlider-example-1"] > [data-preview="ImpactSlider"] > div > div > div > p')).toContainText('A donation of £80 could help pay for:'); + await expect(page.locator('[data-testid="ImpactSlider-example-1"] > [data-preview="ImpactSlider"] > div > div > div > div > p')).toContainText('A donation of £80 could help pay for:'); await expect(page.locator('[data-testid="ImpactSlider-example-1"] [data-testid="impact-slider--moneybuy-1"] [data-testid="moneybuy-amount"]')).toContainText('80'); await expect(page.locator('[data-testid="ImpactSlider-example-1"] [data-testid="impact-slider--moneybuy-2"] [data-testid="moneybuy-amount"]')).toContainText('8'); await expect(page.locator('[data-testid="ImpactSlider-example-1"] [data-testid="impact-slider--moneybuy-3"] [data-testid="moneybuy-amount"]')).toContainText('5'); @@ -196,39 +114,15 @@ test.describe('impact slider component - 1', () => { // donate now button should have the amount as £80 await expect(page.locator('[data-testid="ImpactSlider-example-1"] button[type="submit"]')).toContainText('Donate £80 now'); - // add a short wait for the slider to move back from £80 to £50 await page.waitForTimeout(5000); // drag the slider to the left to decrease the amount to £50 - if (slider) { - // Get the bounding box of the slider - sliderBound = await slider.boundingBox(); - - // Get the target position for the mouse move to a donation of £80 - const targetPosition45 = sliderBound.width * (50 / 100); - - // Perform mouse actions to simulate dragging the slider handle to 80 - await page.mouse.move(sliderBound.x, sliderBound.y + sliderBound.height / 2); - await page.mouse.down(); - - while (sliderBound.width * (parseFloat(await moneyBuyElement.innerText()) / 100) !== targetPosition45) { - await page.mouse.move(sliderBound.x + targetPosition45, sliderBound.y + sliderBound.height / 2); - sliderBound = await slider.boundingBox(); - } - - await page.mouse.down(); - - await page.waitForTimeout(2000); - - // Update targetAmountBeforeMoving after the first slider move - targetAmountBeforeMoving = parseFloat(await moneyBuyElement.innerText()); - console.log('Slider decreased to amount: ', targetAmountBeforeMoving); - } + await setSliderValue(page, 'ImpactSlider-example-1', 50); + console.log('Slider decreased to amount: ', await moneyBuyElement.innerText()); await page.waitForTimeout(2000); - // Validate that the slider is at £50 - await expect(page.locator('[data-testid="ImpactSlider-example-1"] > [data-preview="ImpactSlider"] > div > div > div > p')).toContainText('A donation of £50 could help pay for:'); + await expect(page.locator('[data-testid="ImpactSlider-example-1"] > [data-preview="ImpactSlider"] > div > div > div > div > p')).toContainText('A donation of £50 could help pay for:'); await expect(page.locator('[data-testid="ImpactSlider-example-1"] [data-testid="impact-slider--moneybuy-1"] [data-testid="moneybuy-amount"]')).toContainText('50'); await expect(page.locator('[data-testid="ImpactSlider-example-1"] [data-testid="impact-slider--moneybuy-2"] [data-testid="moneybuy-amount"]')).toContainText('5'); await expect(page.locator('[data-testid="ImpactSlider-example-1"] [data-testid="impact-slider--moneybuy-3"] [data-testid="moneybuy-amount"]')).toContainText('3'); @@ -243,41 +137,18 @@ test.describe('impact slider component - 1', () => { test.describe('impact slider component - 2', () => { test('impact slider - sliding to £45', async ({ page }) => { - await page.goto('/#impactslider'); // Ensure that the slider and its handle are visible await expect(page.locator('[data-testid="ImpactSlider-example-3"]')).toBeVisible(); await expect(page.locator('[data-testid="ImpactSlider-example-3"] #ImpactSlider > div:nth-child(4)')).toBeVisible(); - // slider selector - const sliderSelector = '[data-testid="ImpactSlider-example-3"] #ImpactSlider'; - const slider = await page.$(sliderSelector); - const moneyBuyElement = page.locator('[data-testid="ImpactSlider-example-3"] [data-testid="impact-slider--moneybuy-1"]'); - const moneyBuyText = await moneyBuyElement.innerText(); - console.log('Target initially: ', moneyBuyText); - - if (slider) { - // Get the bounding box of the slider - let sliderBound = await slider.boundingBox(); - - // Get the target position for the mouse move to a donation of £45 - const targetPosition = sliderBound.width * (45 / 100); - - // Perform mouse actions to simulate dragging the slider handle - await page.mouse.move(sliderBound.x, sliderBound.y + sliderBound.height / 2); - await page.mouse.down(); - - while (sliderBound.width * (parseFloat(await moneyBuyElement.innerText()) / 100) !== targetPosition) { - await page.mouse.move(sliderBound.x + targetPosition, sliderBound.y + sliderBound.height / 2); - sliderBound = await slider.boundingBox(); - } + console.log('Target initially: ', await moneyBuyElement.innerText()); - await page.mouse.up(); - } + await setSliderValue(page, 'ImpactSlider-example-3', 45); - await expect(page.locator('[data-testid="ImpactSlider-example-3"] > [data-preview="ImpactSlider"] > div > div > div > p')).toContainText('A donation of £45 could help pay for:'); + await expect(page.locator('[data-testid="ImpactSlider-example-3"] > [data-preview="ImpactSlider"] > div > div > div > div > p')).toContainText('A donation of £45 could help pay for:'); await expect(page.locator('[data-testid="ImpactSlider-example-3"] [data-testid="impact-slider--moneybuy-1"] [data-testid="moneybuy-amount"]')).toContainText('45'); await expect(page.locator('[data-testid="ImpactSlider-example-3"] [data-testid="impact-slider--moneybuy-2"] [data-testid="moneybuy-amount"]')).toContainText('4'); await expect(page.locator('[data-testid="ImpactSlider-example-3"] [data-testid="impact-slider--moneybuy-3"] [data-testid="moneybuy-amount"]')).toContainText('3'); diff --git a/src/App.jsx b/src/App.jsx new file mode 100644 index 000000000..56fdbcde6 --- /dev/null +++ b/src/App.jsx @@ -0,0 +1,94 @@ +import React, { useState, useEffect } from 'react'; +import styled from 'styled-components'; +import { atoms, molecules, organisms, docs } from './demos/index.jsx'; +import { Layout, Sidebar, SidebarTitle, SidebarItem, Preview, PreviewHeader, PreviewBox, Logo, IsolateButton } from './App.styles.js'; +import crLogo from './components/Atoms/Logo/assets/cr-logo.svg'; + +const Chevron = styled.span` + float: right; + display: inline-block; + font-size: 1.2rem; + margin-top: -6px; + transition: transform 0.2s; + transform: ${({ $open }) => ($open ? 'rotate(0deg)' : 'rotate(-90deg)')}; +`; + +const groups = [ + { label: 'Docs', items: docs }, + { label: 'Atoms', items: atoms }, + { label: 'Molecules', items: molecules }, + { label: 'Organisms', items: organisms }, +]; + +const allItems = groups.flatMap(g => g.items); + +function itemFromHash() { + const hash = window.location.hash.slice(1).toLowerCase(); + return allItems.find(item => item.name.toLowerCase() === hash) || atoms[0]; +} + +export default function App() { + const [selected, setSelected] = useState(itemFromHash); + const [isIsolated, setIsIsolated] = useState(false); + const [openGroups, setOpenGroups] = useState(() => + groups.reduce((acc, g) => ({ ...acc, [g.label]: false }), {}) + ); + + const toggleGroup = label => + setOpenGroups(prev => ({ ...prev, [label]: !prev[label] })); + + useEffect(() => { + const onHashChange = () => setSelected(itemFromHash()); + window.addEventListener('hashchange', onHashChange); + return () => window.removeEventListener('hashchange', onHashChange); + }, []); + + const currentItem = allItems.find(item => item.name === selected.name); + + const handleSelect = item => { + window.location.hash = item.name.toLowerCase(); + setSelected(item); + }; + + return ( + + {!isIsolated && ( + + Comic Relief + {groups.map(group => ( +
+ toggleGroup(group.label)}> + {group.label} + + + {openGroups[group.label] && group.items.map(item => ( + handleSelect(item)} + > + {item.name} + + ))} +
+ ))} +
+ )} + + +

{selected.name}

+ setIsIsolated(s => !s)}> + {isIsolated ? 'Show Sidebar' : 'Isolate'} + +
+ {(currentItem?.examples ?? (currentItem?.demo != null ? [currentItem.demo] : [])).map((example, idx) => ( + +
+ {example} +
+
+ ))} +
+
+ ); +} diff --git a/src/App.styles.js b/src/App.styles.js new file mode 100644 index 000000000..634520c82 --- /dev/null +++ b/src/App.styles.js @@ -0,0 +1,108 @@ +import styled from 'styled-components'; +import color from './theme/crTheme/colors'; + +export const Layout = styled.div` + display: flex; + height: 100vh; + font-family: sans-serif; +`; + +export const Sidebar = styled.nav` + width: 240px; + min-width: 240px; + background: ${color('grey_5')}; + color: ${color('white')}; + overflow-y: scroll; + padding: 1rem 0; +`; + +export const SidebarTitle = styled.div` + padding: 1.5rem 1rem 0.75rem; + font-size: 0.8rem; + font-weight: 700; + letter-spacing: 0.1em; + text-transform: uppercase; + color: ${color('red')}; + cursor: pointer; + user-select: none; + + &:hover { + opacity: 0.8; + } +`; + +export const SidebarItem = styled.button` + display: block; + width: 100%; + text-align: left; + padding: 0.4rem 1rem; + background: ${({ $active }) => ($active ? color('grey_4_hover') : color('transparent'))}; + color: ${({ $active }) => ($active ? color('white') : color('grey'))}; + border: none; + cursor: pointer; + font-size: 0.85rem; + border-left: 3px solid ${({ $active }) => ($active ? color('red') : color('transparent'))}; + + &:hover { + background: ${color('grey_dark')}; + color: ${color('white')}; + } +`; + +export const Preview = styled.main` + flex: 1; + overflow-y: auto; + padding: 2rem; + background: ${color('grey_light')}; +`; + +export const PreviewHeader = styled.div` + display: flex; + align-items: center; + justify-content: space-between; + margin: 0 0 1.5rem; + border-bottom: 1px solid ${color('grey_medium')}; + padding-bottom: 0.75rem; + + h2 { + margin: 0; + font-size: 1.25rem; + color: ${color('grey_5')}; + } +`; + +export const PreviewBox = styled.div` + background: ${color('white')}; + border: 1px solid ${color('grey_medium')}; + border-radius: 6px; + padding: 2rem; +`; + +export const Logo = styled.div` + padding: 1rem; + border-bottom: 1px solid ${color('grey_dark')}; + margin-bottom: 0.5rem; + + img { + display: block; + width: 50px; + height: auto; + } +`; + +export const IsolateButton = styled.button` + background: ${color('red')}; + border: 1px solid ${color('red')}; + border-radius: 4px; + color: ${color('white')}; + cursor: pointer; + font-size: 0.75rem; + font-weight: 700; + letter-spacing: 0.05em; + padding: 0.25rem 0.6rem; + + &:hover { + background: ${color('red_dark')}; + border-color: ${color('red_dark')}; + } +`; diff --git a/src/styleguide/assets/HeroBannerLogo-Square.png b/src/assets/HeroBannerLogo-Square.png similarity index 100% rename from src/styleguide/assets/HeroBannerLogo-Square.png rename to src/assets/HeroBannerLogo-Square.png diff --git a/src/styleguide/assets/HeroBannerLogo-Tall.png b/src/assets/HeroBannerLogo-Tall.png similarity index 100% rename from src/styleguide/assets/HeroBannerLogo-Tall.png rename to src/assets/HeroBannerLogo-Tall.png diff --git a/src/styleguide/assets/HeroBannerLogo-Wide.png b/src/assets/HeroBannerLogo-Wide.png similarity index 100% rename from src/styleguide/assets/HeroBannerLogo-Wide.png rename to src/assets/HeroBannerLogo-Wide.png diff --git a/src/styleguide/assets/PromoLW.jpg b/src/assets/PromoLW.jpg similarity index 100% rename from src/styleguide/assets/PromoLW.jpg rename to src/assets/PromoLW.jpg diff --git a/src/styleguide/assets/VideoBannerPosterImage.png b/src/assets/VideoBannerPosterImage.png similarity index 100% rename from src/styleguide/assets/VideoBannerPosterImage.png rename to src/assets/VideoBannerPosterImage.png diff --git a/src/styleguide/assets/challenge-1.jpg b/src/assets/challenge-1.jpg similarity index 100% rename from src/styleguide/assets/challenge-1.jpg rename to src/assets/challenge-1.jpg diff --git a/src/styleguide/assets/mobileVideoPosterImage.png b/src/assets/mobileVideoPosterImage.png similarity index 100% rename from src/styleguide/assets/mobileVideoPosterImage.png rename to src/assets/mobileVideoPosterImage.png diff --git a/src/styleguide/assets/picture-1.jpg b/src/assets/picture-1.jpg similarity index 100% rename from src/styleguide/assets/picture-1.jpg rename to src/assets/picture-1.jpg diff --git a/src/styleguide/assets/picture-2.jpg b/src/assets/picture-2.jpg similarity index 100% rename from src/styleguide/assets/picture-2.jpg rename to src/assets/picture-2.jpg diff --git a/src/styleguide/assets/picture-3.jpg b/src/assets/picture-3.jpg similarity index 100% rename from src/styleguide/assets/picture-3.jpg rename to src/assets/picture-3.jpg diff --git a/src/styleguide/assets/promo.jpg b/src/assets/promo.jpg similarity index 100% rename from src/styleguide/assets/promo.jpg rename to src/assets/promo.jpg diff --git a/src/styleguide/assets/tall.jpg b/src/assets/tall.jpg similarity index 100% rename from src/styleguide/assets/tall.jpg rename to src/assets/tall.jpg diff --git a/src/styleguide/assets/wide.jpg b/src/assets/wide.jpg similarity index 100% rename from src/styleguide/assets/wide.jpg rename to src/assets/wide.jpg diff --git a/src/components/Atoms/AmbientVideo/AmbientVideo.md b/src/components/Atoms/AmbientVideo/AmbientVideo.md deleted file mode 100644 index 05730f777..000000000 --- a/src/components/Atoms/AmbientVideo/AmbientVideo.md +++ /dev/null @@ -1,59 +0,0 @@ -# AmbientVideo - -A muted, full-width ambient video component using the HTML5 video element. Ideal for background or decorative video. - -Default (loop, no controls). - -```js -const defaultData = require('../../../styleguide/data/data').defaultData; -const video480 = require('./big-buck-bunny-480p-30sec.mp4'); - -
- -
-``` - -With full controls. - -```js -const defaultData = require('../../../styleguide/data/data').defaultData; -const video480 = require('./big-buck-bunny-480p-30sec.mp4'); - -
- -
-``` - -With play/pause button (hover to reveal). - -```js -const defaultData = require('../../../styleguide/data/data').defaultData; -const video480 = require('./big-buck-bunny-480p-30sec.mp4'); - -
- -
-``` - -Play once (no loop). - -```js -const defaultData = require('../../../styleguide/data/data').defaultData; -const video480 = require('./big-buck-bunny-480p-30sec.mp4'); - -
- -
-``` - -Responsive: 1080p above M breakpoint (740px), 480p below. Resize the browser to see the switch. - -```js -const defaultData = require('../../../styleguide/data/data').defaultData; -const video480 = require('./thetestdatacom_480p_example.mp4'); -const video1080 = require('./big-buck-bunny-1080p-30sec.mp4'); - -
- -
-``` diff --git a/src/components/Atoms/AmbientVideo/AmbientVideoExample.jsx b/src/components/Atoms/AmbientVideo/AmbientVideoExample.jsx new file mode 100644 index 000000000..3a4331536 --- /dev/null +++ b/src/components/Atoms/AmbientVideo/AmbientVideoExample.jsx @@ -0,0 +1,45 @@ +import React from 'react'; +import styled from 'styled-components'; +import AmbientVideo from './AmbientVideo'; +import { defaultData } from '../../../data/data'; +import video480 from './big-buck-bunny-480p-30sec.mp4'; +import video1080 from './big-buck-bunny-1080p-30sec.mp4'; +import videoMobile from './thetestdatacom_480p_example.mp4'; + +const ExampleContainer = styled.div` + width: 100%; + max-width: ${({ $maxWidth }) => $maxWidth || '600px'}; + aspect-ratio: ${({ $aspectRatio }) => $aspectRatio || '16 / 9'}; + overflow: hidden; +`; + +export default function AmbientVideoExample() { + return ( + <> +

Default (loop, no controls)

+ + + + +

With full controls

+ + + + +

With play/pause button (hover to reveal)

+ + + + +

Play once (no loop)

+ + + + +

Responsive: 1080p above M breakpoint (740px), 480p below

+ + + + + ); +} diff --git a/src/components/Atoms/Button/Button.md b/src/components/Atoms/Button/Button.md deleted file mode 100644 index 48afd3b57..000000000 --- a/src/components/Atoms/Button/Button.md +++ /dev/null @@ -1,101 +0,0 @@ -```js - -import buttonTypes from '../../../theme/crTheme/buttonTypes'; - -<> -

Primary

-
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
-

Secondary

- -
- -
- -
- -
- -
- -
- -
- -
- - -
- -
- -
- -
- -
-

Teritary

- -
- -
- -
- -
- -
- -
- -
- -
- - -
- -
- -
- -
- - - -``` - -```js - -``` - -```js - -``` \ No newline at end of file diff --git a/src/components/Atoms/Button/Button.test.js b/src/components/Atoms/Button/Button.test.js index 282e00785..c47b77afc 100644 --- a/src/components/Atoms/Button/Button.test.js +++ b/src/components/Atoms/Button/Button.test.js @@ -10,24 +10,13 @@ it('renders a standard styled link correctly', () => { expect(tree).toMatchInlineSnapshot(` .c0 { - display: -webkit-inline-box; - display: -webkit-inline-flex; - display: -ms-inline-flexbox; display: inline-flex; position: relative; - -webkit-text-decoration: none; text-decoration: none; - -webkit-transition: all 0.2s; transition: all 0.2s; height: 2.5rem; width: 100%; - -webkit-box-pack: center; - -webkit-justify-content: center; - -ms-flex-pack: center; justify-content: center; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; align-items: center; border: none; cursor: pointer; @@ -38,16 +27,12 @@ it('renders a standard styled link correctly', () => { font-family: 'Montserrat',Helvetica,Arial,sans-serif; font-weight: 700; text-transform: inherit; - -webkit-letter-spacing: 0; - -moz-letter-spacing: 0; - -ms-letter-spacing: 0; letter-spacing: 0; font-size: 1rem; line-height: 1.25rem; } - .c0 > a { - -webkit-text-decoration: none; + .c0 >a { text-decoration: none; } @@ -64,35 +49,37 @@ it('renders a standard styled link correctly', () => { opacity: 0.5; } - @media (min-width:740px) { + @media (min-width: 740px) { .c0 { font-size: 1rem; line-height: 1.25rem; } } - @media (min-width:1024px) { + @media (min-width: 1024px) { .c0 { font-size: 1.125rem; line-height: 1.375rem; } } - @media (min-width:740px) { + @media (min-width: 740px) { .c0 { width: auto; } } - @media (min-width:1024px) { + @media (min-width: 1024px) { .c0 { width: auto; } } + + + + + + + + + + + + + + + + + + + + +
+

Secondary

+ + + + + + + + + + + + + + + + + + + +
+

Tertiary

+ + + + + + + + + + + + + + + + + + + +
+

Other

+ + + + + + + + ); +} diff --git a/src/components/Atoms/ButtonWithStates/ButtonWithStates.md b/src/components/Atoms/ButtonWithStates/ButtonWithStates.md deleted file mode 100644 index 072670156..000000000 --- a/src/components/Atoms/ButtonWithStates/ButtonWithStates.md +++ /dev/null @@ -1,23 +0,0 @@ -## Disabled and loading - -```js -import ButtonWithStates from './ButtonWithStates'; - - - Enter prize draw - -``` - -## Optional prop `children` - -`children` is an optional prop, this example demonstrates the button will not error without any provided. - -```js -import ButtonWithStates from './ButtonWithStates'; - - -``` diff --git a/src/components/Atoms/ButtonWithStates/ButtonWithStatesExample.jsx b/src/components/Atoms/ButtonWithStates/ButtonWithStatesExample.jsx new file mode 100644 index 000000000..e0de541a1 --- /dev/null +++ b/src/components/Atoms/ButtonWithStates/ButtonWithStatesExample.jsx @@ -0,0 +1,10 @@ +import React from 'react'; +import ButtonWithStates from './ButtonWithStates'; + +export default function ButtonWithStatesExample() { + return ( + + Enter prize draw + + ); +} diff --git a/src/components/Atoms/Checkbox/Checkbox.js b/src/components/Atoms/Checkbox/Checkbox.js index 2bf09a75d..feb803fee 100644 --- a/src/components/Atoms/Checkbox/Checkbox.js +++ b/src/components/Atoms/Checkbox/Checkbox.js @@ -26,7 +26,7 @@ const StyledCheckboxInput = styled.input.attrs({ type: 'checkbox' })` width: 1px; /* This span is actually the visual square Checkbox you see */ - + span { + & + span { margin-right: 12px; width: 24px; height: 24px; @@ -37,14 +37,14 @@ const StyledCheckboxInput = styled.input.attrs({ type: 'checkbox' })` flex-shrink: 0; } /* Visual checkbox when ticked */ - :checked + span { + &:checked + span { background: url(${checkBoxIcon}) no-repeat center; background-size: contain; background-color: ${({ theme, checkboxBgChecked }) => (checkboxBgChecked ? theme.color(checkboxBgChecked) : theme.color('red'))}; border: 1px solid ${({ theme, checkboxBorderChecked }) => (checkboxBorderChecked ? theme.color(checkboxBorderChecked) : theme.color('red'))}; } /* Visual checkbox when focused */ - :focus + span { + &:focus + span { border: 1px solid ${({ theme, checkboxBorderFocus }) => (checkboxBorderFocus ? theme.color(checkboxBorderFocus) : theme.color('red'))}; } `; diff --git a/src/components/Atoms/Checkbox/Checkbox.test.js b/src/components/Atoms/Checkbox/Checkbox.test.js index 490c0039b..059840f9f 100644 --- a/src/components/Atoms/Checkbox/Checkbox.test.js +++ b/src/components/Atoms/Checkbox/Checkbox.test.js @@ -12,215 +12,193 @@ it('renders correctly', () => { ).toJSON(); expect(tree).toMatchInlineSnapshot(` - Array [ - .c2 { - font-family: 'Montserrat',Helvetica,Arial,sans-serif; - font-weight: 400; - text-transform: inherit; - -webkit-letter-spacing: 0; - -moz-letter-spacing: 0; - -ms-letter-spacing: 0; - letter-spacing: 0; - font-size: 1rem; - line-height: 1.25rem; - } - - .c2 { - font-size: 1rem; - line-height: normal; - font-weight: bold; - } - - .c2 span { - font-size: inherit; - line-height: inherit; - } - - .c0 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - margin-bottom: 8px; - } - - .c1 { - border: 0; - -webkit-clip: rect(0 0 0 0); - clip: rect(0 0 0 0); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - white-space: nowrap; - width: 1px; - } - - .c1 + span { - margin-right: 12px; - width: 24px; - height: 24px; - border-radius: 4px; - background-color: #FFFFFF; - border: 1px solid #969598; - float: left; - -webkit-flex-shrink: 0; - -ms-flex-negative: 0; - flex-shrink: 0; - } - - .c1:checked + span { - background: url(mock.asset) no-repeat center; - background-size: contain; - background-color: #E52630; - border: 1px solid #E52630; - } - - .c1:focus + span { - border: 1px solid #E52630; - } - - @media (min-width:740px) { - .c2 { - font-size: 1rem; - line-height: 1.25rem; - } - } - - @media (min-width:1024px) { - .c2 { - font-size: 1.125rem; - line-height: 1.375rem; - } - } - - , - .c2 { - font-family: 'Montserrat',Helvetica,Arial,sans-serif; - font-weight: 400; - text-transform: inherit; - -webkit-letter-spacing: 0; - -moz-letter-spacing: 0; - -ms-letter-spacing: 0; - letter-spacing: 0; - font-size: 1rem; - line-height: 1.25rem; - } - - .c2 { - font-size: 1rem; - line-height: normal; - font-weight: bold; - } - - .c2 span { - font-size: inherit; - line-height: inherit; - } - - .c0 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - margin-bottom: 8px; - } - - .c1 { - border: 0; - -webkit-clip: rect(0 0 0 0); - clip: rect(0 0 0 0); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - white-space: nowrap; - width: 1px; - } - - .c1 + span { - margin-right: 12px; - width: 24px; - height: 24px; - border-radius: 4px; - background-color: #FFFFFF; - border: 1px solid #969598; - float: left; - -webkit-flex-shrink: 0; - -ms-flex-negative: 0; - flex-shrink: 0; - } - - .c1:checked + span { - background: url(mock.asset) no-repeat center; - background-size: contain; - background-color: #E52630; - border: 1px solid #E52630; - } - - .c1:focus + span { - border: 1px solid #E52630; - } - - @media (min-width:740px) { - .c2 { - font-size: 1rem; - line-height: 1.25rem; - } - } - - @media (min-width:1024px) { - .c2 { - font-size: 1.125rem; - line-height: 1.375rem; - } - } - - , - ] - `); +[ + .c2 { + font-family: 'Montserrat',Helvetica,Arial,sans-serif; + font-weight: 400; + text-transform: inherit; + letter-spacing: 0; + font-size: 1rem; + line-height: 1.25rem; +} + +.c2 { + font-size: 1rem; + line-height: normal; + font-weight: bold; +} + +.c2 span { + font-size: inherit; + line-height: inherit; +} + +.c0 { + display: flex; + align-items: center; + margin-bottom: 8px; +} + +.c1 { + border: 0; + clip: rect(0 0 0 0); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + white-space: nowrap; + width: 1px; +} + +.c1+span { + margin-right: 12px; + width: 24px; + height: 24px; + border-radius: 4px; + background-color: #FFFFFF; + border: 1px solid #969598; + float: left; + flex-shrink: 0; +} + +.c1:checked+span { + background: url(mock.asset) no-repeat center; + background-size: contain; + background-color: #E52630; + border: 1px solid #E52630; +} + +.c1:focus+span { + border: 1px solid #E52630; +} + +@media (min-width: 740px) { + .c2 { + font-size: 1rem; + line-height: 1.25rem; + } +} + +@media (min-width: 1024px) { + .c2 { + font-size: 1.125rem; + line-height: 1.375rem; + } +} + +, + .c2 { + font-family: 'Montserrat',Helvetica,Arial,sans-serif; + font-weight: 400; + text-transform: inherit; + letter-spacing: 0; + font-size: 1rem; + line-height: 1.25rem; +} + +.c2 { + font-size: 1rem; + line-height: normal; + font-weight: bold; +} + +.c2 span { + font-size: inherit; + line-height: inherit; +} + +.c0 { + display: flex; + align-items: center; + margin-bottom: 8px; +} + +.c1 { + border: 0; + clip: rect(0 0 0 0); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + white-space: nowrap; + width: 1px; +} + +.c1+span { + margin-right: 12px; + width: 24px; + height: 24px; + border-radius: 4px; + background-color: #FFFFFF; + border: 1px solid #969598; + float: left; + flex-shrink: 0; +} + +.c1:checked+span { + background: url(mock.asset) no-repeat center; + background-size: contain; + background-color: #E52630; + border: 1px solid #E52630; +} + +.c1:focus+span { + border: 1px solid #E52630; +} + +@media (min-width: 740px) { + .c2 { + font-size: 1rem; + line-height: 1.25rem; + } +} + +@media (min-width: 1024px) { + .c2 { + font-size: 1.125rem; + line-height: 1.375rem; + } +} + +, +] +`); }); diff --git a/src/components/Atoms/Checkbox/Checkbox.md b/src/components/Atoms/Checkbox/CheckboxExample.jsx similarity index 57% rename from src/components/Atoms/Checkbox/Checkbox.md rename to src/components/Atoms/Checkbox/CheckboxExample.jsx index f600e0c32..552788f46 100644 --- a/src/components/Atoms/Checkbox/Checkbox.md +++ b/src/components/Atoms/Checkbox/CheckboxExample.jsx @@ -1,8 +1,7 @@ -# CheckBox Field - -```js -import Text from '../../Atoms/Text/Text'; -import Link from '../../Atoms/Link/Link'; +import React from 'react'; +import Checkbox from './Checkbox'; +import Text from '../Text/Text'; +import Link from '../Link/Link'; const LongLabel = () => (
@@ -22,12 +21,14 @@ const LongLabel = () => (
); -<> -

List of checkboxes

- - - - +

List of checkboxes

+ + + + ( checkboxBgChecked="green" checkboxBorderChecked="green" checkboxBorderFocus="blue" - /> -
-

A checkbox with a long label containing links

- - - - -``` + /> +
+

A checkbox with a long label containing links

+ + + + + ); +} diff --git a/src/components/Atoms/Confetti/Confetti.js b/src/components/Atoms/Confetti/Confetti.js index f771879f5..b6be2175e 100644 --- a/src/components/Atoms/Confetti/Confetti.js +++ b/src/components/Atoms/Confetti/Confetti.js @@ -35,8 +35,8 @@ export default function Confetti({ trigger, duration = 3000 }) { const refAnimationInstance = useRef(null); const [intervalId, setIntervalId] = useState(); - const getInstance = useCallback(instance => { - refAnimationInstance.current = instance; + const getInstance = useCallback(({ confetti }) => { + refAnimationInstance.current = confetti; }, []); const nextTickAnimation = useCallback(() => { @@ -91,7 +91,7 @@ export default function Confetti({ trigger, duration = 3000 }) { return ( <> - + ); } diff --git a/src/components/Atoms/Confetti/Confetti.md b/src/components/Atoms/Confetti/Confetti.md deleted file mode 100644 index cda49319a..000000000 --- a/src/components/Atoms/Confetti/Confetti.md +++ /dev/null @@ -1,15 +0,0 @@ -# Confetti - -```js -import React, { useState } from 'react'; -import Confetti from './Confetti'; - -const [isConfetti, setIsConfetti] = useState(false); - -const handleConfettiTrigger = () => setIsConfetti(!isConfetti); - -<> - - - -``` diff --git a/src/components/Atoms/Confetti/_TriggerConfetti.js b/src/components/Atoms/Confetti/ConfettiExample.jsx similarity index 74% rename from src/components/Atoms/Confetti/_TriggerConfetti.js rename to src/components/Atoms/Confetti/ConfettiExample.jsx index fb2541fa6..c8a0be43c 100644 --- a/src/components/Atoms/Confetti/_TriggerConfetti.js +++ b/src/components/Atoms/Confetti/ConfettiExample.jsx @@ -1,15 +1,15 @@ import React, { useState } from 'react'; import Confetti from './Confetti'; -export default function TriggerConfetti() { +export default function ConfettiExample() { const [isConfetti, setIsConfetti] = useState(false); return ( - <> - + - ); } diff --git a/src/components/Atoms/ErrorText/ErrorText.md b/src/components/Atoms/ErrorText/ErrorText.md deleted file mode 100644 index a026d2409..000000000 --- a/src/components/Atoms/ErrorText/ErrorText.md +++ /dev/null @@ -1,5 +0,0 @@ -# ErrorText - -```jsx -This is an error -``` diff --git a/src/components/Atoms/ErrorText/ErrorTextExample.jsx b/src/components/Atoms/ErrorText/ErrorTextExample.jsx new file mode 100644 index 000000000..574a38f58 --- /dev/null +++ b/src/components/Atoms/ErrorText/ErrorTextExample.jsx @@ -0,0 +1,8 @@ +import React from 'react'; +import ErrorText from './ErrorText'; + +export default function ErrorTextExample() { + return ( + This is an error + ); +} diff --git a/src/components/Atoms/ErrorText/__snapshots__/ErrorText.test.js.snap b/src/components/Atoms/ErrorText/__snapshots__/ErrorText.test.js.snap index a09415f9d..4ce805af3 100644 --- a/src/components/Atoms/ErrorText/__snapshots__/ErrorText.test.js.snap +++ b/src/components/Atoms/ErrorText/__snapshots__/ErrorText.test.js.snap @@ -5,9 +5,6 @@ exports[`renders correctly 1`] = ` font-family: 'Montserrat',Helvetica,Arial,sans-serif; font-weight: 400; text-transform: inherit; - -webkit-letter-spacing: 0; - -moz-letter-spacing: 0; - -ms-letter-spacing: 0; letter-spacing: 0; font-size: 1rem; line-height: 1.25rem; @@ -32,14 +29,14 @@ exports[`renders correctly 1`] = ` margin-top: 0.6rem; } -@media (min-width:740px) { +@media (min-width: 740px) { .c0 { font-size: 1rem; line-height: 1.25rem; } } -@media (min-width:1024px) { +@media (min-width: 1024px) { .c0 { font-size: 1.125rem; line-height: 1.375rem; diff --git a/src/components/Atoms/Icons/Arrow.js b/src/components/Atoms/Icons/Arrow.js index 12d202abc..009b7cf14 100644 --- a/src/components/Atoms/Icons/Arrow.js +++ b/src/components/Atoms/Icons/Arrow.js @@ -3,8 +3,8 @@ import PropTypes from 'prop-types'; import styled, { withTheme } from 'styled-components'; const angle = { - right: '0', - left: '180deg', + right: '180deg', + left: '0', down: '-90deg', up: '90deg' }; @@ -31,10 +31,10 @@ const Arrow = ({ colour={colour} mobileColour={mobileColour} xmlns="http://www.w3.org/2000/svg" - viewBox="0 0 15 15" + viewBox="0 0 96 96" {...rest} > - + ); diff --git a/src/components/Atoms/Icons/Internal.js b/src/components/Atoms/Icons/Internal.js index 14e209dbb..3c1afd944 100644 --- a/src/components/Atoms/Icons/Internal.js +++ b/src/components/Atoms/Icons/Internal.js @@ -13,7 +13,7 @@ const StyledSVG = styled.svg` `; const Internal = ({ - colour = 'white', mobileColour = null, theme, size = 20, ...rest + colour = 'white', mobileColour = null, theme, size = 24, ...rest }) => ( - + ); diff --git a/src/components/Atoms/InfoMessage/InfoMessage.js b/src/components/Atoms/InfoMessage/InfoMessage.js index c75aaacf4..36066c9c5 100644 --- a/src/components/Atoms/InfoMessage/InfoMessage.js +++ b/src/components/Atoms/InfoMessage/InfoMessage.js @@ -55,13 +55,9 @@ const InfoMessage = ({ ); InfoMessage.propTypes = { - /** Theme colour key from our colour list. */ backgroundColor: PropTypes.string, - /** Value for `data-testid` on the root (defaults to `info-message`). */ dataTestId: PropTypes.string, - /** Bold line; string for the title */ title: PropTypes.node.isRequired, - /** Normal-weight line; string or include `Link` for inline links */ message: PropTypes.node.isRequired }; diff --git a/src/components/Atoms/InfoMessage/InfoMessage.md b/src/components/Atoms/InfoMessage/InfoMessage.md deleted file mode 100644 index 6ab36a7b1..000000000 --- a/src/components/Atoms/InfoMessage/InfoMessage.md +++ /dev/null @@ -1,39 +0,0 @@ - -## Examples - -```js - -``` - -### Alternative background (`coral_light`) - -```js - -``` - -### Message with inline link (JSX) - -```js -import Link from '../Link/Link'; - - - You can only donate between £1.00 and £25,000.00 at a time. If you need help,{' '} - - contact us - - . - - } -/> -``` diff --git a/src/components/Atoms/InfoMessage/InfoMessage.test.js b/src/components/Atoms/InfoMessage/InfoMessage.test.js index 418d435f1..97565e7d7 100644 --- a/src/components/Atoms/InfoMessage/InfoMessage.test.js +++ b/src/components/Atoms/InfoMessage/InfoMessage.test.js @@ -9,7 +9,7 @@ it('renders default blue_light variant', () => { const renderer = renderWithTheme( ); expect(renderer.toJSON()).toMatchSnapshot(); diff --git a/src/components/Atoms/InfoMessage/InfoMessageExample.jsx b/src/components/Atoms/InfoMessage/InfoMessageExample.jsx new file mode 100644 index 000000000..ed6f78d07 --- /dev/null +++ b/src/components/Atoms/InfoMessage/InfoMessageExample.jsx @@ -0,0 +1,31 @@ +import React from 'react'; +import InfoMessage from './InfoMessage'; +import Link from '../Link/Link'; + +export default function InfoMessageExample() { + return ( + <> + +
+ +
+ + You can only donate between £1.00 and £25,000.00 at a time. If you need help,{' '} + contact us. + + } + /> + + ); +} diff --git a/src/components/Atoms/InfoMessage/__snapshots__/InfoMessage.test.js.snap b/src/components/Atoms/InfoMessage/__snapshots__/InfoMessage.test.js.snap index 724b9201a..e513bb7f1 100644 --- a/src/components/Atoms/InfoMessage/__snapshots__/InfoMessage.test.js.snap +++ b/src/components/Atoms/InfoMessage/__snapshots__/InfoMessage.test.js.snap @@ -5,9 +5,6 @@ exports[`renders coral_light variant with message containing a link 1`] = ` font-family: 'Montserrat',Helvetica,Arial,sans-serif; font-weight: 400; text-transform: inherit; - -webkit-letter-spacing: 0; - -moz-letter-spacing: 0; - -ms-letter-spacing: 0; letter-spacing: 0; font-size: 1rem; line-height: 1.25rem; @@ -23,12 +20,12 @@ exports[`renders coral_light variant with message containing a link 1`] = ` display: inline; color: #000000; font-weight: normal; + color: #E52630; } .c4:hover, .c4:focus { color: #000000; - -webkit-text-decoration: none; text-decoration: none; } @@ -36,16 +33,8 @@ exports[`renders coral_light variant with message containing a link 1`] = ` background-color: #FFCECE; border-radius: 1rem; padding: 2rem; - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; display: flex; - -webkit-flex-direction: column; - -ms-flex-direction: column; flex-direction: column; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; align-items: center; text-align: center; gap: 1rem; @@ -57,9 +46,6 @@ exports[`renders coral_light variant with message containing a link 1`] = ` font-family: 'Montserrat',Helvetica,Arial,sans-serif; font-weight: 400; text-transform: inherit; - -webkit-letter-spacing: 0; - -moz-letter-spacing: 0; - -ms-letter-spacing: 0; letter-spacing: 0; font-size: 1rem; line-height: 1.25rem; @@ -71,9 +57,6 @@ exports[`renders coral_light variant with message containing a link 1`] = ` font-family: 'Montserrat',Helvetica,Arial,sans-serif; font-weight: 400; text-transform: inherit; - -webkit-letter-spacing: 0; - -moz-letter-spacing: 0; - -ms-letter-spacing: 0; letter-spacing: 0; font-size: 1rem; line-height: 1.25rem; @@ -81,46 +64,45 @@ exports[`renders coral_light variant with message containing a link 1`] = ` } .c3 a { - -webkit-text-decoration: underline; text-decoration: underline; } -@media (min-width:740px) { +@media (min-width: 740px) { .c1 { font-size: 1rem; line-height: 1.25rem; } } -@media (min-width:1024px) { +@media (min-width: 1024px) { .c1 { font-size: 1.125rem; line-height: 1.375rem; } } -@media (min-width:740px) { +@media (min-width: 740px) { .c2 { font-size: 1rem; line-height: 1.25rem; } } -@media (min-width:1024px) { +@media (min-width: 1024px) { .c2 { font-size: 1.125rem; line-height: 1.375rem; } } -@media (min-width:740px) { +@media (min-width: 740px) { .c3 { font-size: 1rem; line-height: 1.25rem; } } -@media (min-width:1024px) { +@media (min-width: 1024px) { .c3 { font-size: 1.125rem; line-height: 1.375rem; @@ -142,10 +124,16 @@ exports[`renders coral_light variant with message containing a link 1`] = ` You can only donate between £1.00 and £25,000.00 at a time. If you need help, contact us @@ -159,9 +147,6 @@ exports[`renders default blue_light variant 1`] = ` font-family: 'Montserrat',Helvetica,Arial,sans-serif; font-weight: 400; text-transform: inherit; - -webkit-letter-spacing: 0; - -moz-letter-spacing: 0; - -ms-letter-spacing: 0; letter-spacing: 0; font-size: 1rem; line-height: 1.25rem; @@ -176,16 +161,8 @@ exports[`renders default blue_light variant 1`] = ` background-color: #BECCF9; border-radius: 1rem; padding: 2rem; - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; display: flex; - -webkit-flex-direction: column; - -ms-flex-direction: column; flex-direction: column; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; align-items: center; text-align: center; gap: 1rem; @@ -197,9 +174,6 @@ exports[`renders default blue_light variant 1`] = ` font-family: 'Montserrat',Helvetica,Arial,sans-serif; font-weight: 400; text-transform: inherit; - -webkit-letter-spacing: 0; - -moz-letter-spacing: 0; - -ms-letter-spacing: 0; letter-spacing: 0; font-size: 1rem; line-height: 1.25rem; @@ -211,9 +185,6 @@ exports[`renders default blue_light variant 1`] = ` font-family: 'Montserrat',Helvetica,Arial,sans-serif; font-weight: 400; text-transform: inherit; - -webkit-letter-spacing: 0; - -moz-letter-spacing: 0; - -ms-letter-spacing: 0; letter-spacing: 0; font-size: 1rem; line-height: 1.25rem; @@ -221,46 +192,45 @@ exports[`renders default blue_light variant 1`] = ` } .c3 a { - -webkit-text-decoration: underline; text-decoration: underline; } -@media (min-width:740px) { +@media (min-width: 740px) { .c1 { font-size: 1rem; line-height: 1.25rem; } } -@media (min-width:1024px) { +@media (min-width: 1024px) { .c1 { font-size: 1.125rem; line-height: 1.375rem; } } -@media (min-width:740px) { +@media (min-width: 740px) { .c2 { font-size: 1rem; line-height: 1.25rem; } } -@media (min-width:1024px) { +@media (min-width: 1024px) { .c2 { font-size: 1.125rem; line-height: 1.375rem; } } -@media (min-width:740px) { +@media (min-width: 740px) { .c3 { font-size: 1rem; line-height: 1.25rem; } } -@media (min-width:1024px) { +@media (min-width: 1024px) { .c3 { font-size: 1.125rem; line-height: 1.375rem; @@ -279,7 +249,7 @@ exports[`renders default blue_light variant 1`] = `

- If you are, please select the ‘Pay in Fundraising’ tab above. If not, please continue with your donation. + If you are, please select the 'Pay in Fundraising' tab above. If not, please continue with your donation.

`; diff --git a/src/components/Atoms/Input/Input.js b/src/components/Atoms/Input/Input.js index efe04dd27..03df7261c 100644 --- a/src/components/Atoms/Input/Input.js +++ b/src/components/Atoms/Input/Input.js @@ -52,7 +52,7 @@ const InputField = styled.input`${({ theme, error, prefixLength }) => css` z-index: 2; font-family: inherit; - :focus { + &:focus { border: 1px solid ${theme.color('grey_for_forms')}; } `}`; diff --git a/src/components/Atoms/Input/Input.md b/src/components/Atoms/Input/Input.md deleted file mode 100644 index 3bf5b0851..000000000 --- a/src/components/Atoms/Input/Input.md +++ /dev/null @@ -1,152 +0,0 @@ -```js -

Input required with label and hint

- -``` - -```js -

Input with error message

- -``` - -```js -

Simple input (optional)

- -``` - -```js -

Simple input (required)

- -``` - - -```js -

Input Label with markup

- -``` - -```js -import styled from 'styled-components'; -import Text from '../../Atoms/Text/Text'; - -const ItalicText = styled(Text).attrs({weight: 'normal'})` - font-style: italic -`; - -<> -

Input label as React element

- Email (please check it's correct)} - errorMsg="" - id="input-example-6" - showLabel={true} - /> - -``` - -```js -

Input with prefix

-

(This example also ensures there are two decimal places onBlur)

- { - const price = event.target.value; - if (typeof Number(price) === 'number') { - event.target.value = Number(price).toFixed(2); - } - }} - /> -``` - -```js -

Input with responsive max width

- -``` - -```js -

Input with dark label

- -``` - -```js - import Text from '../../Atoms/Text/Text'; - - const exampleDescription = ( - Here's a description with some formatting - ); - - <> -

Input with Description:

- - -``` diff --git a/src/components/Atoms/Input/InputExample.jsx b/src/components/Atoms/Input/InputExample.jsx new file mode 100644 index 000000000..8b4e492af --- /dev/null +++ b/src/components/Atoms/Input/InputExample.jsx @@ -0,0 +1,129 @@ +import React from 'react'; +import styled from 'styled-components'; +import Input from './Input'; +import Text from '../Text/Text'; + +const ItalicText = styled(Text).attrs({ weight: 'normal' })` + font-style: italic; +`; + +export default function InputExample() { + return ( + <> +

Input required with label and hint

+ + +

Input with error message

+ + +

Simple input (optional)

+ + +

Simple input (required)

+ + +

Input Label with markup

+ + +

Input label as React element

+ Email (please check it's correct)} + errorMsg="" + id="input-example-6" + showLabel={true} + /> + +

Input with prefix

+

(This example also ensures there are two decimal places onBlur)

+ { + const price = event.target.value; + if (typeof Number(price) === 'number') { + event.target.value = Number(price).toFixed(2); + } + }} + /> + +

Input with responsive max width

+ + +

Input with dark label

+ + +

Input with Description:

+ Here's a description with some formatting} + /> + + ); +} diff --git a/src/components/Atoms/Input/input.test.js b/src/components/Atoms/Input/input.test.js index 68ca61bca..b9b912b93 100644 --- a/src/components/Atoms/Input/input.test.js +++ b/src/components/Atoms/Input/input.test.js @@ -16,187 +16,157 @@ it('renders correctly', () => { ).toJSON(); expect(tree).toMatchInlineSnapshot(` - .c1 { - font-family: 'Montserrat',Helvetica,Arial,sans-serif; - font-weight: 400; - text-transform: inherit; - -webkit-letter-spacing: 0; - -moz-letter-spacing: 0; - -ms-letter-spacing: 0; - letter-spacing: 0; - font-size: 1rem; - line-height: 1.25rem; - } - - .c1 span { - font-size: inherit; - line-height: inherit; - } - - .c0 { - width: 100%; - position: relative; - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-flex-direction: column; - -ms-flex-direction: column; - flex-direction: column; - color: #000000; - } - - .c2 { - margin-bottom: 0.5rem; - font-family: 'Montserrat',Helvetica,Arial,sans-serif; - font-weight: 400; - text-transform: inherit; - -webkit-letter-spacing: 0; - -moz-letter-spacing: 0; - -ms-letter-spacing: 0; - letter-spacing: 0; - font-size: 1rem; - line-height: 1.25rem; - } - - .c3 { - position: relative; - font-family: 'Montserrat',Helvetica,Arial,sans-serif; - font-weight: 400; - text-transform: inherit; - -webkit-letter-spacing: 0; - -moz-letter-spacing: 0; - -ms-letter-spacing: 0; - letter-spacing: 0; - font-size: 1rem; - line-height: 1.25rem; - } - - .c4 { - position: relative; - width: 100%; - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: end; - -webkit-justify-content: flex-end; - -ms-flex-pack: end; - justify-content: flex-end; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - } - - .c5 { - position: relative; - box-sizing: border-box; - width: 100%; - height: 48px; - padding: 1rem; - background-color: #F4F3F5; - border: 1px solid; - border-color: #969598; - box-shadow: none; - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; - color: #000000; - border-radius: 0.5rem; - font-size: inherit; - z-index: 2; - font-family: inherit; - } - - .c5:focus { - border: 1px solid #666; - } - - @media (min-width:740px) { - .c1 { - font-size: 1rem; - line-height: 1.25rem; +.c1 { + font-family: 'Montserrat',Helvetica,Arial,sans-serif; + font-weight: 400; + text-transform: inherit; + letter-spacing: 0; + font-size: 1rem; + line-height: 1.25rem; +} + +.c1 span { + font-size: inherit; + line-height: inherit; +} + +.c0 { + width: 100%; + position: relative; + display: flex; + flex-direction: column; + color: #000000; +} + +.c2 { + margin-bottom: 0.5rem; + font-family: 'Montserrat',Helvetica,Arial,sans-serif; + font-weight: 400; + text-transform: inherit; + letter-spacing: 0; + font-size: 1rem; + line-height: 1.25rem; +} + +.c3 { + position: relative; + font-family: 'Montserrat',Helvetica,Arial,sans-serif; + font-weight: 400; + text-transform: inherit; + letter-spacing: 0; + font-size: 1rem; + line-height: 1.25rem; +} + +.c4 { + position: relative; + width: 100%; + display: flex; + justify-content: flex-end; + align-items: center; +} + +.c5 { + position: relative; + box-sizing: border-box; + width: 100%; + height: 48px; + padding: 1rem; + background-color: #F4F3F5; + border: 1px solid; + border-color: #969598; + box-shadow: none; + appearance: none; + color: #000000; + border-radius: 0.5rem; + font-size: inherit; + z-index: 2; + font-family: inherit; +} + +.c5:focus { + border: 1px solid #666; +} + +@media (min-width: 740px) { + .c1 { + font-size: 1rem; + line-height: 1.25rem; + } +} + +@media (min-width: 1024px) { + .c1 { + font-size: 1.125rem; + line-height: 1.375rem; + } +} + +@media (min-width: 740px) { + .c2 { + font-size: 1rem; + line-height: 1.25rem; + } +} + +@media (min-width: 1024px) { + .c2 { + font-size: 1rem; + line-height: 1.25rem; + } +} + +@media (min-width: 740px) { + .c3 { + font-size: 1rem; + line-height: 1.25rem; + } +} + +@media (min-width: 1024px) { + .c3 { + font-size: 1.25rem; + line-height: 1.25rem; + } +} + + +`); }); it('renders with responsive max widths correctly', () => { @@ -213,189 +183,169 @@ it('renders with responsive max widths correctly', () => { ).toJSON(); expect(tree).toMatchInlineSnapshot(` - .c1 { - font-family: 'Montserrat',Helvetica,Arial,sans-serif; - font-weight: 400; - text-transform: inherit; - -webkit-letter-spacing: 0; - -moz-letter-spacing: 0; - -ms-letter-spacing: 0; - letter-spacing: 0; - font-size: 1rem; - line-height: 1.25rem; - } - - .c1 span { - font-size: inherit; - line-height: inherit; - } - - .c0 { - width: 100%; - position: relative; - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-flex-direction: column; - -ms-flex-direction: column; - flex-direction: column; - color: #000000; - } - - .c2 { - margin-bottom: 0.5rem; - font-family: 'Montserrat',Helvetica,Arial,sans-serif; - font-weight: 400; - text-transform: inherit; - -webkit-letter-spacing: 0; - -moz-letter-spacing: 0; - -ms-letter-spacing: 0; - letter-spacing: 0; - font-size: 1rem; - line-height: 1.25rem; - } - - .c3 { - position: relative; - font-family: 'Montserrat',Helvetica,Arial,sans-serif; - font-weight: 400; - text-transform: inherit; - -webkit-letter-spacing: 0; - -moz-letter-spacing: 0; - -ms-letter-spacing: 0; - letter-spacing: 0; - font-size: 1rem; - line-height: 1.25rem; - } - - .c4 { - position: relative; - width: 100%; - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: end; - -webkit-justify-content: flex-end; - -ms-flex-pack: end; - justify-content: flex-end; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - } - - .c5 { - position: relative; - box-sizing: border-box; - width: 100%; - height: 48px; - padding: 1rem; - background-color: #F4F3F5; - border: 1px solid; - border-color: #969598; - box-shadow: none; - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; - color: #000000; - border-radius: 0.5rem; - font-size: inherit; - z-index: 2; - font-family: inherit; - } - - .c5:focus { - border: 1px solid #666; - } - - @media (min-width:740px) { - .c1 { - font-size: 1rem; - line-height: 1.25rem; +.c1 { + font-family: 'Montserrat',Helvetica,Arial,sans-serif; + font-weight: 400; + text-transform: inherit; + letter-spacing: 0; + font-size: 1rem; + line-height: 1.25rem; +} + +.c1 span { + font-size: inherit; + line-height: inherit; +} + +.c0 { + width: 100%; + position: relative; + display: flex; + flex-direction: column; + color: #000000; +} + +.c2 { + margin-bottom: 0.5rem; + font-family: 'Montserrat',Helvetica,Arial,sans-serif; + font-weight: 400; + text-transform: inherit; + letter-spacing: 0; + font-size: 1rem; + line-height: 1.25rem; +} + +.c3 { + position: relative; + font-family: 'Montserrat',Helvetica,Arial,sans-serif; + font-weight: 400; + text-transform: inherit; + letter-spacing: 0; + font-size: 1rem; + line-height: 1.25rem; +} + +.c4 { + position: relative; + width: 100%; + display: flex; + justify-content: flex-end; + align-items: center; +} + +.c5 { + position: relative; + box-sizing: border-box; + width: 100%; + height: 48px; + padding: 1rem; + background-color: #F4F3F5; + border: 1px solid; + border-color: #969598; + box-shadow: none; + appearance: none; + color: #000000; + border-radius: 0.5rem; + font-size: inherit; + z-index: 2; + font-family: inherit; +} + +.c5:focus { + border: 1px solid #666; +} + +@media (min-width: 740px) { + .c1 { + font-size: 1rem; + line-height: 1.25rem; + } +} + +@media (min-width: 1024px) { + .c1 { + font-size: 1.125rem; + line-height: 1.375rem; + } +} + +@media (min-width: 740px) { + .c2 { + font-size: 1rem; + line-height: 1.25rem; + } +} + +@media (min-width: 1024px) { + .c2 { + font-size: 1rem; + line-height: 1.25rem; + } +} + +@media (min-width: 740px) { + .c3 { + font-size: 1rem; + line-height: 1.25rem; + } +} + +@media (min-width: 1024px) { + .c3 { + font-size: 1.25rem; + line-height: 1.25rem; + } +} + +@media (min-width: 740px) { + .c4 { + max-width: 150px; + } +} + +@media (min-width: 1024px) { + .c4 { + max-width: 250px; + } +} + + +`); }); diff --git a/src/components/Atoms/Label/Label.js b/src/components/Atoms/Label/Label.js index 1779fd1c6..3fb382d1e 100644 --- a/src/components/Atoms/Label/Label.js +++ b/src/components/Atoms/Label/Label.js @@ -22,7 +22,7 @@ const LabelElement = styled.label` color: ${getLabelColor}; ${({ optional, theme }) => optional === true && ` - :after { + &:after { position: absolute; top: 0; right: 0; diff --git a/src/components/Atoms/Label/Label.md b/src/components/Atoms/Label/Label.md deleted file mode 100644 index 3d8a41e4d..000000000 --- a/src/components/Atoms/Label/Label.md +++ /dev/null @@ -1,21 +0,0 @@ -```js - -``` - -```js -import styled from 'styled-components'; - -const StyledInput = styled.input` - max-width: 300px; - font-size: 1.5rem; - height: 2.5rem; - border-radius: 5px; - border-width: 1px; -`; - - -``` diff --git a/src/components/Atoms/Label/LabelExample.jsx b/src/components/Atoms/Label/LabelExample.jsx new file mode 100644 index 000000000..5c54b0b48 --- /dev/null +++ b/src/components/Atoms/Label/LabelExample.jsx @@ -0,0 +1,27 @@ +import React from 'react'; +import styled from 'styled-components'; +import Label from './Label'; + +const StyledInput = styled.input` + max-width: 300px; + font-size: 1.5rem; + height: 2.5rem; + border-radius: 5px; + border-width: 1px; +`; + +export default function LabelExample() { + return ( + <> + + +
+ + + + ); +} diff --git a/src/components/Atoms/Link/Link.md b/src/components/Atoms/Link/Link.md deleted file mode 100644 index e4938f3cc..000000000 --- a/src/components/Atoms/Link/Link.md +++ /dev/null @@ -1,223 +0,0 @@ -```js -import { External, Download, Favourite, Internal } from '../Icons/index'; - -
-
- - Link standard - -
-
- } - > - Link standard icon - -
-
- - Link standard white - -
-
; -``` - -```js - -import buttonTypes from '../../../theme/crTheme/buttonTypes'; - -
-
- - Link as button - -
-
- - Link as button - -
-
- - Link as button - -
- - -
- - Link as button (secondary) - -
-
- - Link as button (secondary) - -
-
- - Link as button (secondary) - -
- -
- - Link as button (tertiary) - -
-
- - Link as button (tertiary) - -
-
- - Link as button (tertiary) - -
- -
- -
- - Link as full-width red button - -
-
-
-``` - - -## Iconography -```js -import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from '../Icons/index'; - -
-
- } - > - Internal link, 'blue' with red icon on tablet and mobile - -
- -
- } - > - External link (black on mobile, blue on desktop) - -
- -
- } - > - Download link (blue mobile-tablet icon, white desktop icon) - -
- -
- } - > - Favourite link (blue mobile-tablet icon, white desktop icon) - -
- -
- } - > - Chevron Up (blue mobile-tablet icon, white desktop icon) - -
- -
- } - > - Chevron Down (blue mobile-tablet icon, white desktop icon) - -
- -
- } - > - Chevron Left (blue mobile-tablet icon, white desktop icon) - -
- -
- } - > - Chevron Right (blue mobile-tablet icon, white desktop icon) - -
- -
- } - > - Arrow Left (blue mobile-tablet icon, white desktop icon) - -
- -
- } - > - At Sign (blue mobile-tablet icon, white desktop icon) - -
-
; -``` diff --git a/src/components/Atoms/Link/Link.style.js b/src/components/Atoms/Link/Link.style.js index 134b1a2e9..4f57c286d 100644 --- a/src/components/Atoms/Link/Link.style.js +++ b/src/components/Atoms/Link/Link.style.js @@ -48,6 +48,7 @@ const linkStyle = () => css` ${({ type, theme }) => (type ? theme.linkStyles(type) : theme.linkStyles('standard'))}; + ${({ $color, theme }) => $color && css`color: ${theme.color($color)};`} `; export const IconWrapper = styled.span` diff --git a/src/components/Atoms/Link/Link.test.js b/src/components/Atoms/Link/Link.test.js index b416e9e90..20c84c167 100644 --- a/src/components/Atoms/Link/Link.test.js +++ b/src/components/Atoms/Link/Link.test.js @@ -12,29 +12,35 @@ it('renders a standard styled link correctly', () => { ).toJSON(); expect(tree).toMatchInlineSnapshot(` - .c0 { - position: relative; - display: inline; - color: #000000; - font-weight: normal; - } +.c0 { + position: relative; + display: inline; + color: #000000; + font-weight: normal; + color: #E52630; +} - .c0:hover, - .c0:focus { - color: #000000; - -webkit-text-decoration: none; - text-decoration: none; - } +.c0:hover, +.c0:focus { + color: #000000; + text-decoration: none; +} - - A standard link - - `); + + A standard link + +`); }); it('renders a button with an icon', () => { @@ -50,84 +56,87 @@ it('renders a button with an icon', () => { ).toJSON(); expect(tree).toMatchInlineSnapshot(` - .c1 { - display: -webkit-inline-box; - display: -webkit-inline-flex; - display: -ms-inline-flexbox; - display: inline-flex; - margin-left: 1rem; - -webkit-align-self: center; - -ms-flex-item-align: center; - align-self: center; - right: 1.5rem; - position: absolute; - right: -2rem; - top: 0; - bottom: 0; - } +.c1 { + display: inline-flex; + margin-left: 1rem; + align-self: center; + right: 1.5rem; + position: absolute; + right: -2rem; + top: 0; + bottom: 0; +} - .c0 { - position: relative; - display: inline; - color: #000000; - font-weight: normal; - } +.c0 { + position: relative; + display: inline; + color: #000000; + font-weight: normal; + color: #E52630; +} - .c0:hover, - .c0:focus { - color: #000000; - -webkit-text-decoration: none; - text-decoration: none; - } +.c0:hover, +.c0:focus { + color: #000000; + text-decoration: none; +} - .c2 { - fill: #FFFFFF; - } +.c2 { + fill: #FFFFFF; +} - @media (min-width:740px) { - .c1 { - width: auto; - right: auto; - position: relative; - position: absolute; - right: -2rem; - top: 0; - bottom: 0; - } - } +@media (min-width: 740px) { + .c1 { + width: auto; + right: auto; + position: relative; + position: absolute; + right: -2rem; + top: 0; + bottom: 0; + } +} - @media (min-width:1024px) { - .c2 { - fill: #FFFFFF; - } - } +@media (min-width: 1024px) { + .c2 { + fill: #FFFFFF; + } +} - + Internal link + + - Internal link - - - - - - - `); + + + + +`); }); it('renders a standard styled link correctly with target blank and assistive text', () => { @@ -138,49 +147,53 @@ it('renders a standard styled link correctly with target blank and assistive tex ).toJSON(); expect(tree).toMatchInlineSnapshot(` - .c0 { - position: relative; - display: inline; - color: #000000; - font-weight: normal; - } +.c0 { + position: relative; + display: inline; + color: #000000; + font-weight: normal; + color: #E52630; +} - .c0:hover, - .c0:focus { - color: #000000; - -webkit-text-decoration: none; - text-decoration: none; - } +.c0:hover, +.c0:focus { + color: #000000; + text-decoration: none; +} - .c1 { - border: 0; - -webkit-clip: rect(0 0 0 0); - clip: rect(0 0 0 0); - -webkit-clip-path: inset(50%); - clip-path: inset(50%); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - white-space: nowrap; - width: 1px; - } +.c1 { + border: 0; + clip: rect(0 0 0 0); + clip-path: inset(50%); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + white-space: nowrap; + width: 1px; +} - - A standard link - - (opens in new window) - - - `); + + A standard link + + (opens in new window) + + +`); }); it('renders link styled as button correctly', () => { @@ -191,89 +204,81 @@ it('renders link styled as button correctly', () => { ).toJSON(); expect(tree).toMatchInlineSnapshot(` - .c0 { - display: -webkit-inline-box; - display: -webkit-inline-flex; - display: -ms-inline-flexbox; - display: inline-flex; - position: relative; - -webkit-text-decoration: none; - text-decoration: none; - -webkit-transition: all 0.2s; - transition: all 0.2s; - height: 2.5rem; - width: 100%; - -webkit-box-pack: center; - -webkit-justify-content: center; - -ms-flex-pack: center; - justify-content: center; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - border: none; - cursor: pointer; - padding: 0.6rem 1rem; - border-radius: 0.5rem; - background-color: #FFE400; - color: #000000; - font-family: 'Montserrat',Helvetica,Arial,sans-serif; - font-weight: 700; - text-transform: inherit; - -webkit-letter-spacing: 0; - -moz-letter-spacing: 0; - -ms-letter-spacing: 0; - letter-spacing: 0; - font-size: 1rem; - line-height: 1.25rem; - } +.c0 { + display: inline-flex; + position: relative; + text-decoration: none; + transition: all 0.2s; + height: 2.5rem; + width: 100%; + justify-content: center; + align-items: center; + border: none; + cursor: pointer; + padding: 0.6rem 1rem; + border-radius: 0.5rem; + background-color: #FFE400; + color: #000000; + font-family: 'Montserrat',Helvetica,Arial,sans-serif; + font-weight: 700; + text-transform: inherit; + letter-spacing: 0; + font-size: 1rem; + line-height: 1.25rem; +} - .c0:hover, - .c0:focus, - .c0:focus-within, - .c0:focus-visible { - background-color: #FEFD5A; - outline-offset: 3px; - } +.c0:hover, +.c0:focus, +.c0:focus-within, +.c0:focus-visible { + background-color: #FEFD5A; + outline-offset: 3px; +} - .c0:disabled { - cursor: not-allowed; - opacity: 0.5; - } +.c0:disabled { + cursor: not-allowed; + opacity: 0.5; +} - @media (min-width:740px) { - .c0 { - font-size: 1rem; - line-height: 1.25rem; - } - } +@media (min-width: 740px) { + .c0 { + font-size: 1rem; + line-height: 1.25rem; + } +} - @media (min-width:1024px) { - .c0 { - font-size: 1.125rem; - line-height: 1.375rem; - } - } +@media (min-width: 1024px) { + .c0 { + font-size: 1.125rem; + line-height: 1.375rem; + } +} - @media (min-width:740px) { - .c0 { - width: auto; - } - } +@media (min-width: 740px) { + .c0 { + width: auto; + } +} - @media (min-width:1024px) { - .c0 { - width: auto; - } - } +@media (min-width: 1024px) { + .c0 { + width: auto; + } +} - - A yellow button - - `); + + A yellow button + +`); }); diff --git a/src/components/Atoms/Link/LinkExample.jsx b/src/components/Atoms/Link/LinkExample.jsx new file mode 100644 index 000000000..63535bbd2 --- /dev/null +++ b/src/components/Atoms/Link/LinkExample.jsx @@ -0,0 +1,110 @@ +import React from 'react'; +import styled from 'styled-components'; +import Link from './Link'; +import buttonTypes from '../../../theme/crTheme/buttonTypes'; +import { External, Download, Favourite, Internal, Chevron, Arrow, AtSign } from '../Icons/index'; + +const ExampleWrapper = styled.div` + background-color: ${({ $bg }) => $bg || '#ddd'}; + padding: 15px; + margin-bottom: 10px; + border-radius: 5px; +`; + +export default function LinkExample() { + return ( + <> +

Standard links

+ + Link standard + + + Link override colour + + + }> + Link standard icon + + + + Link standard white + + +

Links as buttons

+ + Link as button + + + Link as button + + + Link as button + + + Link as button (secondary) + + + Link as button (secondary) + + + Link as button (secondary) + + + Link as button (tertiary) + + + Link as button (tertiary) + + + Link as button (tertiary) + + +
+ Link as full-width red button +
+
+ +

Iconography

+ + }> + Internal link, 'blue' with red icon on tablet and mobile + + + + }> + External link (black on mobile, blue on desktop) + + + + }> + Download link (blue mobile-tablet icon, white desktop icon) + + + + }> + Favourite link (blue mobile-tablet icon, white desktop icon) + + + + }> + Chevron Up + + + + }> + Chevron Down + + + + }> + Arrow Left + + + + }> + At Sign + + + + ); +} diff --git a/src/components/Atoms/Logo/Logo.md b/src/components/Atoms/Logo/Logo.md deleted file mode 100644 index b155eaa04..000000000 --- a/src/components/Atoms/Logo/Logo.md +++ /dev/null @@ -1,22 +0,0 @@ -# Comic Relief Logo - -```js - -``` - -# Sport Relief Logo - -```js - -``` - -# Sport Relief Game On Logo - -```js - -``` diff --git a/src/components/Atoms/Logo/Logo.test.js b/src/components/Atoms/Logo/Logo.test.js index d426b6b8a..1aae4fc88 100644 --- a/src/components/Atoms/Logo/Logo.test.js +++ b/src/components/Atoms/Logo/Logo.test.js @@ -19,13 +19,11 @@ it('renders correctly', () => { display: inline-block; z-index: 3; width: 51px; - -webkit-transform: rotate(-14deg); - -ms-transform: rotate(-14deg); transform: rotate(-14deg); vertical-align: bottom; } - @media (min-width:1150px) { + @media (min-width: 1150px) { .c0 { width: 70px; } @@ -34,6 +32,8 @@ it('renders correctly', () => {
Comic Relief logo +

Comic Relief Logo

+ + +

Sport Relief Logo

+ + +

Sport Relief Game On Logo

+ + + ); +} diff --git a/src/components/Atoms/LogoNav2026/LogoNav2026.test.js b/src/components/Atoms/LogoNav2026/LogoNav2026.test.js index cff93ec77..aca9c4e75 100644 --- a/src/components/Atoms/LogoNav2026/LogoNav2026.test.js +++ b/src/components/Atoms/LogoNav2026/LogoNav2026.test.js @@ -8,16 +8,13 @@ it('renders correctly', () => { expect(tree).toMatchInlineSnapshot(` .c0 img { - -webkit-animation: jaJSCW 0.4s ease-in-out forwards; - animation: jaJSCW 0.4s ease-in-out forwards; - -webkit-animation-name: blCpAO; - animation-name: blCpAO; + animation: k0 0.4s ease-in-out forwards; + animation-name: k1; } .c0:hover img, .c0:focus img { - -webkit-animation: jaJSCW 0.4s ease-in-out forwards; - animation: jaJSCW 0.4s ease-in-out forwards; + animation: k0 0.4s ease-in-out forwards; } .c1 { @@ -39,13 +36,13 @@ it('renders correctly', () => { display: none; } - @media (min-width:320px) { + @media (min-width: 320px) { .c2 { display: none; } } - @media (min-width:320px) { + @media (min-width: 320px) { .c3 { display: block; width: 132px; @@ -53,14 +50,14 @@ it('renders correctly', () => { } } - @media (min-width:740px) { + @media (min-width: 740px) { .c3 { width: 162px; height: 25px; } } - @media (min-width:1024px) { + @media (min-width: 1024px) { .c3 { width: 162px; min-width: 162px; @@ -68,6 +65,42 @@ it('renders correctly', () => { } } + @keyframes k0 { + from { + transform: scale3d(1,1,1); + } + + 30% { + transform: scale3d(1.04,1.04,1.04); + } + + 60% { + transform: scale3d(1.03,1.03,1.03); + } + + to { + transform: scale3d(1.04,1.04,1.04); + } + } + + @keyframes k1 { + from { + transform: scale3d(1.03,1.03,1.03); + } + + 30% { + transform: scale3d(0.99,0.99,0.99); + } + + 60% { + transform: scale3d(1.01,1.01,1.01); + } + + to { + transform: scale3d(1,1,1); + } + } + { if (!(selected || disabled)) { return css` - :hover { + &:hover { background: ${theme.color(backgroundColorOnHover)}; color: ${theme.color(colorOnHover)}; } diff --git a/src/components/Atoms/Pagination/Pagination.md b/src/components/Atoms/Pagination/Pagination.md deleted file mode 100644 index 68d4a067d..000000000 --- a/src/components/Atoms/Pagination/Pagination.md +++ /dev/null @@ -1,159 +0,0 @@ -### Minimalist - -```js - `example.com/page/${value}`} - onSelect={(event, value) => { - event.preventDefault(); - console.log(value); - }} - showFirst={false} - showPrevious={false} - showNext={false} - showLast={false} -/> - - `example.com/page/${value}`} - onSelect={(event, value) => { - event.preventDefault(); - console.log(value); - }} - showFirst={false} - showPrevious={false} - showNext={false} - showLast={false} - selectedBackgroundColor="black" -/> -``` - -### Full size - -```js - `example.com/page/${value}`} - onSelect={(event, value) => { - event.preventDefault(); - console.log(value); - }} - showFirst={true} - showPrevious={true} - showNext={true} - showLast={true} - showMore={true} -/> - - `example.com/page/${value}`} - onSelect={(event, value) => { - event.preventDefault(); - console.log(value); - }} - showFirst={true} - showPrevious={true} - showNext={true} - showLast={true} - showMore={true} - selectedBackgroundColor="purple" -/> - - `example.com/page/${value}`} - onSelect={(event, value) => { - event.preventDefault(); - console.log(value); - }} - showFirst={true} - showPrevious={true} - showNext={true} - showLast={true} - showMore={true} - selectedBackgroundColor="blue" -/> - - `example.com/page/${value}`} - onSelect={(event, value) => { - event.preventDefault(); - console.log(value); - }} - showFirst={true} - showPrevious={true} - showNext={true} - showLast={true} - showMore={true} - selectedBackgroundColor="green" -/> -``` - -### Custom style - -```js - `example.com/page/${value}`} - onSelect={(event, value) => { - event.preventDefault(); - console.log(value); - }} - showFirst={true} - showPrevious={true} - showNext={true} - showLast={true} - showMore={true} - color="red" - backgroundColor="yellow" - selectedColor="yellow" - selectedBackgroundColor="teal" - disabledColor="white" - disabledBackgroundColor="grey_light" - colorOnHover="yellow" - backgroundColorOnHover="teal" -/> -``` - -### Custom labels - -```js - `example.com/page/${value}`} - onSelect={(event, value) => { - event.preventDefault(); - console.log(value); - }} - showFirst={true} - showPrevious={true} - showNext={true} - showLast={true} - showMore={true} - previousLabel="Previous" - nextLabel="Next" - firstLabel="First" - lastLabel="Last" - moreLabel="More" - getPageLabel={value => `Page ${value}`} -/> -``` diff --git a/src/components/Atoms/Pagination/PaginationExample.jsx b/src/components/Atoms/Pagination/PaginationExample.jsx new file mode 100644 index 000000000..3fc983c84 --- /dev/null +++ b/src/components/Atoms/Pagination/PaginationExample.jsx @@ -0,0 +1,128 @@ +import React from 'react'; +import Pagination from './Pagination'; + +export default function PaginationExample() { + return ( + <> +

Minimalist

+ `example.com/page/${value}`} + onSelect={(event, value) => { event.preventDefault(); console.log(value); }} + showFirst={false} + showPrevious={false} + showNext={false} + showLast={false} + /> + `example.com/page/${value}`} + onSelect={(event, value) => { event.preventDefault(); console.log(value); }} + showFirst={false} + showPrevious={false} + showNext={false} + showLast={false} + selectedBackgroundColor="black" + /> + +

Full size

+ `example.com/page/${value}`} + onSelect={(event, value) => { event.preventDefault(); console.log(value); }} + showFirst={true} + showPrevious={true} + showNext={true} + showLast={true} + showMore={true} + /> + `example.com/page/${value}`} + onSelect={(event, value) => { event.preventDefault(); console.log(value); }} + showFirst={true} + showPrevious={true} + showNext={true} + showLast={true} + showMore={true} + selectedBackgroundColor="purple" + /> + `example.com/page/${value}`} + onSelect={(event, value) => { event.preventDefault(); console.log(value); }} + showFirst={true} + showPrevious={true} + showNext={true} + showLast={true} + showMore={true} + selectedBackgroundColor="blue" + /> + `example.com/page/${value}`} + onSelect={(event, value) => { event.preventDefault(); console.log(value); }} + showFirst={true} + showPrevious={true} + showNext={true} + showLast={true} + showMore={true} + selectedBackgroundColor="green" + /> + +

Custom style

+ `example.com/page/${value}`} + onSelect={(event, value) => { event.preventDefault(); console.log(value); }} + showFirst={true} + showPrevious={true} + showNext={true} + showLast={true} + showMore={true} + color="red" + backgroundColor="yellow" + selectedColor="yellow" + selectedBackgroundColor="teal" + disabledColor="white" + disabledBackgroundColor="grey_light" + colorOnHover="yellow" + backgroundColorOnHover="teal" + /> + +

Custom labels

+ `example.com/page/${value}`} + onSelect={(event, value) => { event.preventDefault(); console.log(value); }} + showFirst={true} + showPrevious={true} + showNext={true} + showLast={true} + showMore={true} + previousLabel="Previous" + nextLabel="Next" + firstLabel="First" + lastLabel="Last" + moreLabel="More" + getPageLabel={value => `Page ${value}`} + /> + + ); +} diff --git a/src/components/Atoms/Pagination/__snapshots__/Pagination.test.js.snap b/src/components/Atoms/Pagination/__snapshots__/Pagination.test.js.snap index ade71b55f..78b1588f5 100644 --- a/src/components/Atoms/Pagination/__snapshots__/Pagination.test.js.snap +++ b/src/components/Atoms/Pagination/__snapshots__/Pagination.test.js.snap @@ -2,17 +2,9 @@ exports[`renders correctly in full size with first page selected 1`] = ` .c0 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; display: flex; padding-left: 0; - -webkit-box-pack: center; - -webkit-justify-content: center; - -ms-flex-pack: center; justify-content: center; - -webkit-flex-wrap: wrap; - -ms-flex-wrap: wrap; flex-wrap: wrap; list-style-type: none; } @@ -25,7 +17,6 @@ exports[`renders correctly in full size with first page selected 1`] = ` padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: default; @@ -37,7 +28,6 @@ exports[`renders correctly in full size with first page selected 1`] = ` padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: default; @@ -49,7 +39,6 @@ exports[`renders correctly in full size with first page selected 1`] = ` padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: pointer; @@ -70,12 +59,19 @@ exports[`renders correctly in full size with first page selected 1`] = ` >
« @@ -86,12 +82,19 @@ exports[`renders correctly in full size with first page selected 1`] = ` > ‹ @@ -102,12 +105,19 @@ exports[`renders correctly in full size with first page selected 1`] = ` > 1 @@ -118,12 +128,19 @@ exports[`renders correctly in full size with first page selected 1`] = ` > 2 @@ -134,12 +151,19 @@ exports[`renders correctly in full size with first page selected 1`] = ` > 3 @@ -150,12 +174,19 @@ exports[`renders correctly in full size with first page selected 1`] = ` > 4 @@ -166,12 +197,19 @@ exports[`renders correctly in full size with first page selected 1`] = ` > 5 @@ -182,12 +220,19 @@ exports[`renders correctly in full size with first page selected 1`] = ` > › @@ -198,12 +243,19 @@ exports[`renders correctly in full size with first page selected 1`] = ` > » @@ -214,17 +266,9 @@ exports[`renders correctly in full size with first page selected 1`] = ` exports[`renders correctly in full size with last page selected 1`] = ` .c0 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; display: flex; padding-left: 0; - -webkit-box-pack: center; - -webkit-justify-content: center; - -ms-flex-pack: center; justify-content: center; - -webkit-flex-wrap: wrap; - -ms-flex-wrap: wrap; flex-wrap: wrap; list-style-type: none; } @@ -237,7 +281,6 @@ exports[`renders correctly in full size with last page selected 1`] = ` padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: pointer; @@ -254,7 +297,6 @@ exports[`renders correctly in full size with last page selected 1`] = ` padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: default; @@ -266,7 +308,6 @@ exports[`renders correctly in full size with last page selected 1`] = ` padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: default; @@ -282,12 +323,19 @@ exports[`renders correctly in full size with last page selected 1`] = ` > « @@ -298,12 +346,19 @@ exports[`renders correctly in full size with last page selected 1`] = ` > ‹ @@ -314,12 +369,19 @@ exports[`renders correctly in full size with last page selected 1`] = ` > 1 @@ -330,12 +392,19 @@ exports[`renders correctly in full size with last page selected 1`] = ` > 2 @@ -346,12 +415,19 @@ exports[`renders correctly in full size with last page selected 1`] = ` > 3 @@ -362,12 +438,19 @@ exports[`renders correctly in full size with last page selected 1`] = ` > 4 @@ -378,12 +461,19 @@ exports[`renders correctly in full size with last page selected 1`] = ` > 5 @@ -394,12 +484,19 @@ exports[`renders correctly in full size with last page selected 1`] = ` > › @@ -410,12 +507,19 @@ exports[`renders correctly in full size with last page selected 1`] = ` > » @@ -426,17 +530,9 @@ exports[`renders correctly in full size with last page selected 1`] = ` exports[`renders correctly in full size with max pages less than current page 1`] = ` .c0 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; display: flex; padding-left: 0; - -webkit-box-pack: center; - -webkit-justify-content: center; - -ms-flex-pack: center; justify-content: center; - -webkit-flex-wrap: wrap; - -ms-flex-wrap: wrap; flex-wrap: wrap; list-style-type: none; } @@ -449,7 +545,6 @@ exports[`renders correctly in full size with max pages less than current page 1` padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: pointer; @@ -466,7 +561,6 @@ exports[`renders correctly in full size with max pages less than current page 1` padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: default; @@ -478,7 +572,6 @@ exports[`renders correctly in full size with max pages less than current page 1` padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: default; @@ -494,12 +587,19 @@ exports[`renders correctly in full size with max pages less than current page 1` > « @@ -510,12 +610,19 @@ exports[`renders correctly in full size with max pages less than current page 1` > ‹ @@ -526,12 +633,19 @@ exports[`renders correctly in full size with max pages less than current page 1` > ... @@ -542,12 +656,19 @@ exports[`renders correctly in full size with max pages less than current page 1` > 16 @@ -558,12 +679,19 @@ exports[`renders correctly in full size with max pages less than current page 1` > 17 @@ -574,12 +702,19 @@ exports[`renders correctly in full size with max pages less than current page 1` > 18 @@ -590,12 +725,19 @@ exports[`renders correctly in full size with max pages less than current page 1` > 19 @@ -606,12 +748,19 @@ exports[`renders correctly in full size with max pages less than current page 1` > 20 @@ -622,12 +771,19 @@ exports[`renders correctly in full size with max pages less than current page 1` > › @@ -638,12 +794,19 @@ exports[`renders correctly in full size with max pages less than current page 1` > » @@ -654,17 +817,9 @@ exports[`renders correctly in full size with max pages less than current page 1` exports[`renders correctly in full size with max pages less than total pages 1`] = ` .c0 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; display: flex; padding-left: 0; - -webkit-box-pack: center; - -webkit-justify-content: center; - -ms-flex-pack: center; justify-content: center; - -webkit-flex-wrap: wrap; - -ms-flex-wrap: wrap; flex-wrap: wrap; list-style-type: none; } @@ -677,7 +832,6 @@ exports[`renders correctly in full size with max pages less than total pages 1`] padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: pointer; @@ -694,7 +848,6 @@ exports[`renders correctly in full size with max pages less than total pages 1`] padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: default; @@ -706,7 +859,6 @@ exports[`renders correctly in full size with max pages less than total pages 1`] padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: default; @@ -722,12 +874,19 @@ exports[`renders correctly in full size with max pages less than total pages 1`] > « @@ -738,12 +897,19 @@ exports[`renders correctly in full size with max pages less than total pages 1`] > ‹ @@ -754,12 +920,19 @@ exports[`renders correctly in full size with max pages less than total pages 1`] > 1 @@ -770,12 +943,19 @@ exports[`renders correctly in full size with max pages less than total pages 1`] > 2 @@ -786,12 +966,19 @@ exports[`renders correctly in full size with max pages less than total pages 1`] > 3 @@ -802,12 +989,19 @@ exports[`renders correctly in full size with max pages less than total pages 1`] > 4 @@ -818,12 +1012,19 @@ exports[`renders correctly in full size with max pages less than total pages 1`] > 5 @@ -834,12 +1035,19 @@ exports[`renders correctly in full size with max pages less than total pages 1`] > 6 @@ -850,12 +1058,19 @@ exports[`renders correctly in full size with max pages less than total pages 1`] > ... @@ -866,12 +1081,19 @@ exports[`renders correctly in full size with max pages less than total pages 1`] > › @@ -882,12 +1104,19 @@ exports[`renders correctly in full size with max pages less than total pages 1`] > » @@ -898,17 +1127,9 @@ exports[`renders correctly in full size with max pages less than total pages 1`] exports[`renders correctly in full size with max pages more than total pages 1`] = ` .c0 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; display: flex; padding-left: 0; - -webkit-box-pack: center; - -webkit-justify-content: center; - -ms-flex-pack: center; justify-content: center; - -webkit-flex-wrap: wrap; - -ms-flex-wrap: wrap; flex-wrap: wrap; list-style-type: none; } @@ -921,7 +1142,6 @@ exports[`renders correctly in full size with max pages more than total pages 1`] padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: pointer; @@ -938,7 +1158,6 @@ exports[`renders correctly in full size with max pages more than total pages 1`] padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: default; @@ -954,12 +1173,19 @@ exports[`renders correctly in full size with max pages more than total pages 1`] > « @@ -970,12 +1196,19 @@ exports[`renders correctly in full size with max pages more than total pages 1`] > ‹ @@ -986,12 +1219,19 @@ exports[`renders correctly in full size with max pages more than total pages 1`] > 1 @@ -1002,12 +1242,19 @@ exports[`renders correctly in full size with max pages more than total pages 1`] > 2 @@ -1018,12 +1265,19 @@ exports[`renders correctly in full size with max pages more than total pages 1`] > 3 @@ -1034,12 +1288,19 @@ exports[`renders correctly in full size with max pages more than total pages 1`] > 4 @@ -1050,12 +1311,19 @@ exports[`renders correctly in full size with max pages more than total pages 1`] > 5 @@ -1066,12 +1334,19 @@ exports[`renders correctly in full size with max pages more than total pages 1`] > 6 @@ -1082,12 +1357,19 @@ exports[`renders correctly in full size with max pages more than total pages 1`] > › @@ -1098,12 +1380,19 @@ exports[`renders correctly in full size with max pages more than total pages 1`] > » @@ -1114,17 +1403,9 @@ exports[`renders correctly in full size with max pages more than total pages 1`] exports[`renders correctly in full size with more on both sides 1`] = ` .c0 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; display: flex; padding-left: 0; - -webkit-box-pack: center; - -webkit-justify-content: center; - -ms-flex-pack: center; justify-content: center; - -webkit-flex-wrap: wrap; - -ms-flex-wrap: wrap; flex-wrap: wrap; list-style-type: none; } @@ -1137,7 +1418,6 @@ exports[`renders correctly in full size with more on both sides 1`] = ` padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: pointer; @@ -1154,7 +1434,6 @@ exports[`renders correctly in full size with more on both sides 1`] = ` padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: default; @@ -1166,7 +1445,6 @@ exports[`renders correctly in full size with more on both sides 1`] = ` padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: default; @@ -1182,12 +1460,19 @@ exports[`renders correctly in full size with more on both sides 1`] = ` > « @@ -1198,12 +1483,19 @@ exports[`renders correctly in full size with more on both sides 1`] = ` > ‹ @@ -1214,12 +1506,19 @@ exports[`renders correctly in full size with more on both sides 1`] = ` > ... @@ -1230,12 +1529,19 @@ exports[`renders correctly in full size with more on both sides 1`] = ` > 2 @@ -1246,12 +1552,19 @@ exports[`renders correctly in full size with more on both sides 1`] = ` > 3 @@ -1262,12 +1575,19 @@ exports[`renders correctly in full size with more on both sides 1`] = ` > 4 @@ -1278,12 +1598,19 @@ exports[`renders correctly in full size with more on both sides 1`] = ` > 5 @@ -1294,12 +1621,19 @@ exports[`renders correctly in full size with more on both sides 1`] = ` > 6 @@ -1310,12 +1644,19 @@ exports[`renders correctly in full size with more on both sides 1`] = ` > ... @@ -1326,12 +1667,19 @@ exports[`renders correctly in full size with more on both sides 1`] = ` > › @@ -1342,12 +1690,19 @@ exports[`renders correctly in full size with more on both sides 1`] = ` > » @@ -1358,17 +1713,9 @@ exports[`renders correctly in full size with more on both sides 1`] = ` exports[`renders correctly in full size with more on left 1`] = ` .c0 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; display: flex; padding-left: 0; - -webkit-box-pack: center; - -webkit-justify-content: center; - -ms-flex-pack: center; justify-content: center; - -webkit-flex-wrap: wrap; - -ms-flex-wrap: wrap; flex-wrap: wrap; list-style-type: none; } @@ -1381,7 +1728,6 @@ exports[`renders correctly in full size with more on left 1`] = ` padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: pointer; @@ -1398,7 +1744,6 @@ exports[`renders correctly in full size with more on left 1`] = ` padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: default; @@ -1410,7 +1755,6 @@ exports[`renders correctly in full size with more on left 1`] = ` padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: default; @@ -1426,12 +1770,19 @@ exports[`renders correctly in full size with more on left 1`] = ` > « @@ -1442,12 +1793,19 @@ exports[`renders correctly in full size with more on left 1`] = ` > ‹ @@ -1458,12 +1816,19 @@ exports[`renders correctly in full size with more on left 1`] = ` > ... @@ -1474,12 +1839,19 @@ exports[`renders correctly in full size with more on left 1`] = ` > 2 @@ -1490,12 +1862,19 @@ exports[`renders correctly in full size with more on left 1`] = ` > 3 @@ -1506,12 +1885,19 @@ exports[`renders correctly in full size with more on left 1`] = ` > 4 @@ -1522,12 +1908,19 @@ exports[`renders correctly in full size with more on left 1`] = ` > 5 @@ -1538,12 +1931,19 @@ exports[`renders correctly in full size with more on left 1`] = ` > 6 @@ -1554,12 +1954,19 @@ exports[`renders correctly in full size with more on left 1`] = ` > › @@ -1570,12 +1977,19 @@ exports[`renders correctly in full size with more on left 1`] = ` > » @@ -1586,17 +2000,9 @@ exports[`renders correctly in full size with more on left 1`] = ` exports[`renders correctly in full size with more on right 1`] = ` .c0 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; display: flex; padding-left: 0; - -webkit-box-pack: center; - -webkit-justify-content: center; - -ms-flex-pack: center; justify-content: center; - -webkit-flex-wrap: wrap; - -ms-flex-wrap: wrap; flex-wrap: wrap; list-style-type: none; } @@ -1609,7 +2015,6 @@ exports[`renders correctly in full size with more on right 1`] = ` padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: pointer; @@ -1626,7 +2031,6 @@ exports[`renders correctly in full size with more on right 1`] = ` padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: default; @@ -1638,7 +2042,6 @@ exports[`renders correctly in full size with more on right 1`] = ` padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: default; @@ -1654,12 +2057,19 @@ exports[`renders correctly in full size with more on right 1`] = ` > « @@ -1670,12 +2080,19 @@ exports[`renders correctly in full size with more on right 1`] = ` > ‹ @@ -1686,12 +2103,19 @@ exports[`renders correctly in full size with more on right 1`] = ` > 1 @@ -1702,12 +2126,19 @@ exports[`renders correctly in full size with more on right 1`] = ` > 2 @@ -1718,12 +2149,19 @@ exports[`renders correctly in full size with more on right 1`] = ` > 3 @@ -1734,12 +2172,19 @@ exports[`renders correctly in full size with more on right 1`] = ` > 4 @@ -1750,12 +2195,19 @@ exports[`renders correctly in full size with more on right 1`] = ` > 5 @@ -1766,12 +2218,19 @@ exports[`renders correctly in full size with more on right 1`] = ` > ... @@ -1782,12 +2241,19 @@ exports[`renders correctly in full size with more on right 1`] = ` > › @@ -1798,12 +2264,19 @@ exports[`renders correctly in full size with more on right 1`] = ` > » @@ -1814,17 +2287,9 @@ exports[`renders correctly in full size with more on right 1`] = ` exports[`renders correctly in minimalist form 1`] = ` .c0 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; display: flex; padding-left: 0; - -webkit-box-pack: center; - -webkit-justify-content: center; - -ms-flex-pack: center; justify-content: center; - -webkit-flex-wrap: wrap; - -ms-flex-wrap: wrap; flex-wrap: wrap; list-style-type: none; } @@ -1837,7 +2302,6 @@ exports[`renders correctly in minimalist form 1`] = ` padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: pointer; @@ -1854,7 +2318,6 @@ exports[`renders correctly in minimalist form 1`] = ` padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: default; @@ -1870,12 +2333,19 @@ exports[`renders correctly in minimalist form 1`] = ` > 1 @@ -1886,12 +2356,19 @@ exports[`renders correctly in minimalist form 1`] = ` > 2 @@ -1902,12 +2379,19 @@ exports[`renders correctly in minimalist form 1`] = ` > 3 @@ -1918,12 +2402,19 @@ exports[`renders correctly in minimalist form 1`] = ` > 4 @@ -1934,12 +2425,19 @@ exports[`renders correctly in minimalist form 1`] = ` > 5 @@ -1950,17 +2448,9 @@ exports[`renders correctly in minimalist form 1`] = ` exports[`renders correctly in minimalist form with non-default color 1`] = ` .c0 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; display: flex; padding-left: 0; - -webkit-box-pack: center; - -webkit-justify-content: center; - -ms-flex-pack: center; justify-content: center; - -webkit-flex-wrap: wrap; - -ms-flex-wrap: wrap; flex-wrap: wrap; list-style-type: none; } @@ -1973,7 +2463,6 @@ exports[`renders correctly in minimalist form with non-default color 1`] = ` padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: pointer; @@ -1990,7 +2479,6 @@ exports[`renders correctly in minimalist form with non-default color 1`] = ` padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: default; @@ -2006,12 +2494,19 @@ exports[`renders correctly in minimalist form with non-default color 1`] = ` > 1 @@ -2022,12 +2517,19 @@ exports[`renders correctly in minimalist form with non-default color 1`] = ` > 2 @@ -2038,12 +2540,19 @@ exports[`renders correctly in minimalist form with non-default color 1`] = ` > 3 @@ -2054,12 +2563,19 @@ exports[`renders correctly in minimalist form with non-default color 1`] = ` > 4 @@ -2070,12 +2586,19 @@ exports[`renders correctly in minimalist form with non-default color 1`] = ` > 5 @@ -2086,17 +2609,9 @@ exports[`renders correctly in minimalist form with non-default color 1`] = ` exports[`renders correctly with custom labels 1`] = ` .c0 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; display: flex; padding-left: 0; - -webkit-box-pack: center; - -webkit-justify-content: center; - -ms-flex-pack: center; justify-content: center; - -webkit-flex-wrap: wrap; - -ms-flex-wrap: wrap; flex-wrap: wrap; list-style-type: none; } @@ -2109,7 +2624,6 @@ exports[`renders correctly with custom labels 1`] = ` padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: pointer; @@ -2126,7 +2640,6 @@ exports[`renders correctly with custom labels 1`] = ` padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: default; @@ -2142,12 +2655,19 @@ exports[`renders correctly with custom labels 1`] = ` > First @@ -2158,12 +2678,19 @@ exports[`renders correctly with custom labels 1`] = ` > Previous @@ -2174,12 +2701,19 @@ exports[`renders correctly with custom labels 1`] = ` > Page 1 @@ -2190,12 +2724,19 @@ exports[`renders correctly with custom labels 1`] = ` > Page 2 @@ -2206,12 +2747,19 @@ exports[`renders correctly with custom labels 1`] = ` > Page 3 @@ -2222,12 +2770,19 @@ exports[`renders correctly with custom labels 1`] = ` > Page 4 @@ -2238,12 +2793,19 @@ exports[`renders correctly with custom labels 1`] = ` > Page 5 @@ -2254,12 +2816,19 @@ exports[`renders correctly with custom labels 1`] = ` > Next @@ -2270,12 +2839,19 @@ exports[`renders correctly with custom labels 1`] = ` > Last @@ -2286,17 +2862,9 @@ exports[`renders correctly with custom labels 1`] = ` exports[`renders correctly with custom style 1`] = ` .c0 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; display: flex; padding-left: 0; - -webkit-box-pack: center; - -webkit-justify-content: center; - -ms-flex-pack: center; justify-content: center; - -webkit-flex-wrap: wrap; - -ms-flex-wrap: wrap; flex-wrap: wrap; list-style-type: none; } @@ -2309,7 +2877,6 @@ exports[`renders correctly with custom style 1`] = ` padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: pointer; @@ -2326,7 +2893,6 @@ exports[`renders correctly with custom style 1`] = ` padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: default; @@ -2338,7 +2904,6 @@ exports[`renders correctly with custom style 1`] = ` padding: 9px 14px 9px 14px; border-radius: 30px; text-align: center; - -webkit-text-decoration: none; text-decoration: none; font-weight: 700; cursor: default; @@ -2354,12 +2919,19 @@ exports[`renders correctly with custom style 1`] = ` > « @@ -2370,12 +2942,19 @@ exports[`renders correctly with custom style 1`] = ` > ‹ @@ -2386,12 +2965,19 @@ exports[`renders correctly with custom style 1`] = ` > ... @@ -2402,12 +2988,19 @@ exports[`renders correctly with custom style 1`] = ` > 3 @@ -2418,12 +3011,19 @@ exports[`renders correctly with custom style 1`] = ` > 4 @@ -2434,12 +3034,19 @@ exports[`renders correctly with custom style 1`] = ` > 5 @@ -2450,12 +3057,19 @@ exports[`renders correctly with custom style 1`] = ` > 6 @@ -2466,12 +3080,19 @@ exports[`renders correctly with custom style 1`] = ` > 7 @@ -2482,12 +3103,19 @@ exports[`renders correctly with custom style 1`] = ` > ... @@ -2498,12 +3126,19 @@ exports[`renders correctly with custom style 1`] = ` > › @@ -2514,12 +3149,19 @@ exports[`renders correctly with custom style 1`] = ` > » diff --git a/src/components/Atoms/Picture/Picture.md b/src/components/Atoms/Picture/Picture.md deleted file mode 100644 index 6c89d89c7..000000000 --- a/src/components/Atoms/Picture/Picture.md +++ /dev/null @@ -1,28 +0,0 @@ -Picture has depenciy of lazysizes for lazyload and blur-up for image loading state. - -Picture - -```js -const defaultData = require('../../../styleguide/data/data').defaultData; -; -``` - -Custom Size. - -```js -const defaultData = require('../../../styleguide/data/data').defaultData; -; -``` - -Single image - -```js -const defaultData = require('../../../styleguide/data/data').defaultData;; -``` diff --git a/src/components/Atoms/Picture/Picture.test.js b/src/components/Atoms/Picture/Picture.test.js index 42657905f..e4e814127 100644 --- a/src/components/Atoms/Picture/Picture.test.js +++ b/src/components/Atoms/Picture/Picture.test.js @@ -1,9 +1,9 @@ -import React from "react"; -import "jest-styled-components"; -import renderWithTheme from "../../../../tests/hoc/shallowWithTheme"; -import Picture from "./Picture"; -import { defaultData } from "../../../styleguide/data/data"; -it("renders correctly", () => { +import React from 'react'; +import 'jest-styled-components'; +import renderWithTheme from '../../../../tests/hoc/shallowWithTheme'; +import Picture from './Picture'; +import { defaultData } from '../../../data/data'; +it('renders correctly', () => { const tree = renderWithTheme( {
{ data-src="http://images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg" data-srcset="//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=200&h=150&q=50 200w,//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=400&h=300&q=50 400w,//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=800&h=600&q=50 800w,//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=1200&h=900&q=50 1200w,//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=1440&h=1080&q=50 1440w" height="auto" + mediumBreakpointRowLayout={null} + objFitState={true} + objectFit="none" + smallBreakpointRowLayout={null} src="http://images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg" srcSet="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" width="100%" @@ -48,7 +58,7 @@ it("renders correctly", () => { `); }); -it("renders correctly with custom props", () => { +it('renders correctly with custom props', () => { const tree = renderWithTheme( {
{ data-src="http://images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg" data-srcset="//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=200&h=150&q=50 200w,//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=400&h=300&q=50 400w,//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=800&h=600&q=50 800w,//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=1200&h=900&q=50 1200w,//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=1440&h=1080&q=50 1440w" height="100px" + mediumBreakpointRowLayout={null} + objFitState={true} + objectFit="cover" + smallBreakpointRowLayout={null} src="http://images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg" srcSet="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" width="200px" diff --git a/src/components/Atoms/Picture/PictureExample.jsx b/src/components/Atoms/Picture/PictureExample.jsx new file mode 100644 index 000000000..38f94a1ed --- /dev/null +++ b/src/components/Atoms/Picture/PictureExample.jsx @@ -0,0 +1,33 @@ +import React from 'react'; +import Picture from './Picture'; +import { defaultData } from '../../../data/data'; + +export default function PictureExample() { + return ( + <> +

Picture

+ + +

Custom Size

+ + +

Single image

+ + + ); +} diff --git a/src/components/Atoms/RadioButton/RadioButton.js b/src/components/Atoms/RadioButton/RadioButton.js index 4403d523e..871a17f3e 100644 --- a/src/components/Atoms/RadioButton/RadioButton.js +++ b/src/components/Atoms/RadioButton/RadioButton.js @@ -19,7 +19,7 @@ const StyledRadioInput = styled.input` left: 0; right: 0; flex-shrink: 0; - + span { + & + span { left: 2px; border-radius: 30px; background-clip: padding-box; @@ -29,10 +29,10 @@ const StyledRadioInput = styled.input` height: 30px; border: 1px solid ${({ theme }) => theme.color('grey_for_forms')}; } - :checked + span { + &:checked + span { background-color: ${({ theme }) => theme.color('purple')}; border: 1px solid ${({ theme }) => theme.color('purple')}; - :before { + &:before { position: absolute; content: ''; top: 8px; diff --git a/src/components/Atoms/RadioButton/RadioButton.md b/src/components/Atoms/RadioButton/RadioButton.md deleted file mode 100644 index e51db6529..000000000 --- a/src/components/Atoms/RadioButton/RadioButton.md +++ /dev/null @@ -1,16 +0,0 @@ -# Radio buttons - -```js - - - -``` diff --git a/src/components/Atoms/RadioButton/RadioButton.test.js b/src/components/Atoms/RadioButton/RadioButton.test.js index 0818545e8..bbff6252f 100644 --- a/src/components/Atoms/RadioButton/RadioButton.test.js +++ b/src/components/Atoms/RadioButton/RadioButton.test.js @@ -12,233 +12,211 @@ it('renders correctly', () => { ).toJSON(); expect(tree).toMatchInlineSnapshot(` - Array [ - .c2 { - font-family: 'Montserrat',Helvetica,Arial,sans-serif; - font-weight: 400; - text-transform: inherit; - -webkit-letter-spacing: 0; - -moz-letter-spacing: 0; - -ms-letter-spacing: 0; - letter-spacing: 0; - font-size: 1rem; - line-height: 1.25rem; - } - - .c2 { - font-size: 1rem; - line-height: normal; - font-weight: bold; - } - - .c2 span { - font-size: inherit; - line-height: inherit; - } - - .c1 { - background-color: #FFFFFF; - z-index: 1; - top: 0; - margin: 5px 10px; - width: 30px; - height: 30px; - opacity: 0; - left: 0; - right: 0; - -webkit-flex-shrink: 0; - -ms-flex-negative: 0; - flex-shrink: 0; - } - - .c1 + span { - left: 2px; - border-radius: 30px; - background-clip: padding-box; - position: absolute; - top: 0px; - width: 30px; - height: 30px; - border: 1px solid #666; - } - - .c1:checked + span { - background-color: #6F3AAB; - border: 1px solid #6F3AAB; - } - - .c1:checked + span:before { - position: absolute; - content: ''; - top: 8px; - left: 0; - right: 0; - background-color: #FFFFFF; - border-radius: 30px; - width: 12px; - height: 12px; - z-index: 1; - margin: 0 auto; - opacity: 1; - } - - .c0 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - position: relative; - } - - @media (min-width:740px) { - .c2 { - font-size: 1rem; - line-height: 1.25rem; - } - } - - @media (min-width:1024px) { - .c2 { - font-size: 1.125rem; - line-height: 1.375rem; - } - } - - , - .c2 { - font-family: 'Montserrat',Helvetica,Arial,sans-serif; - font-weight: 400; - text-transform: inherit; - -webkit-letter-spacing: 0; - -moz-letter-spacing: 0; - -ms-letter-spacing: 0; - letter-spacing: 0; - font-size: 1rem; - line-height: 1.25rem; - } - - .c2 { - font-size: 1rem; - line-height: normal; - font-weight: bold; - } - - .c2 span { - font-size: inherit; - line-height: inherit; - } - - .c1 { - background-color: #FFFFFF; - z-index: 1; - top: 0; - margin: 5px 10px; - width: 30px; - height: 30px; - opacity: 0; - left: 0; - right: 0; - -webkit-flex-shrink: 0; - -ms-flex-negative: 0; - flex-shrink: 0; - } - - .c1 + span { - left: 2px; - border-radius: 30px; - background-clip: padding-box; - position: absolute; - top: 0px; - width: 30px; - height: 30px; - border: 1px solid #666; - } - - .c1:checked + span { - background-color: #6F3AAB; - border: 1px solid #6F3AAB; - } - - .c1:checked + span:before { - position: absolute; - content: ''; - top: 8px; - left: 0; - right: 0; - background-color: #FFFFFF; - border-radius: 30px; - width: 12px; - height: 12px; - z-index: 1; - margin: 0 auto; - opacity: 1; - } - - .c0 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - position: relative; - } - - @media (min-width:740px) { - .c2 { - font-size: 1rem; - line-height: 1.25rem; - } - } - - @media (min-width:1024px) { - .c2 { - font-size: 1.125rem; - line-height: 1.375rem; - } - } - - , - ] - `); +[ + .c2 { + font-family: 'Montserrat',Helvetica,Arial,sans-serif; + font-weight: 400; + text-transform: inherit; + letter-spacing: 0; + font-size: 1rem; + line-height: 1.25rem; +} + +.c2 { + font-size: 1rem; + line-height: normal; + font-weight: bold; +} + +.c2 span { + font-size: inherit; + line-height: inherit; +} + +.c1 { + background-color: #FFFFFF; + z-index: 1; + top: 0; + margin: 5px 10px; + width: 30px; + height: 30px; + opacity: 0; + left: 0; + right: 0; + flex-shrink: 0; +} + +.c1+span { + left: 2px; + border-radius: 30px; + background-clip: padding-box; + position: absolute; + top: 0px; + width: 30px; + height: 30px; + border: 1px solid #666; +} + +.c1:checked+span { + background-color: #6F3AAB; + border: 1px solid #6F3AAB; +} + +.c1:checked+span:before { + position: absolute; + content: ''; + top: 8px; + left: 0; + right: 0; + background-color: #FFFFFF; + border-radius: 30px; + width: 12px; + height: 12px; + z-index: 1; + margin: 0 auto; + opacity: 1; +} + +.c0 { + display: flex; + align-items: center; + position: relative; +} + +@media (min-width: 740px) { + .c2 { + font-size: 1rem; + line-height: 1.25rem; + } +} + +@media (min-width: 1024px) { + .c2 { + font-size: 1.125rem; + line-height: 1.375rem; + } +} + +, + .c2 { + font-family: 'Montserrat',Helvetica,Arial,sans-serif; + font-weight: 400; + text-transform: inherit; + letter-spacing: 0; + font-size: 1rem; + line-height: 1.25rem; +} + +.c2 { + font-size: 1rem; + line-height: normal; + font-weight: bold; +} + +.c2 span { + font-size: inherit; + line-height: inherit; +} + +.c1 { + background-color: #FFFFFF; + z-index: 1; + top: 0; + margin: 5px 10px; + width: 30px; + height: 30px; + opacity: 0; + left: 0; + right: 0; + flex-shrink: 0; +} + +.c1+span { + left: 2px; + border-radius: 30px; + background-clip: padding-box; + position: absolute; + top: 0px; + width: 30px; + height: 30px; + border: 1px solid #666; +} + +.c1:checked+span { + background-color: #6F3AAB; + border: 1px solid #6F3AAB; +} + +.c1:checked+span:before { + position: absolute; + content: ''; + top: 8px; + left: 0; + right: 0; + background-color: #FFFFFF; + border-radius: 30px; + width: 12px; + height: 12px; + z-index: 1; + margin: 0 auto; + opacity: 1; +} + +.c0 { + display: flex; + align-items: center; + position: relative; +} + +@media (min-width: 740px) { + .c2 { + font-size: 1rem; + line-height: 1.25rem; + } +} + +@media (min-width: 1024px) { + .c2 { + font-size: 1.125rem; + line-height: 1.375rem; + } +} + +, +] +`); }); diff --git a/src/components/Atoms/RadioButton/RadioButtonExample.jsx b/src/components/Atoms/RadioButton/RadioButtonExample.jsx new file mode 100644 index 000000000..f9940a1ff --- /dev/null +++ b/src/components/Atoms/RadioButton/RadioButtonExample.jsx @@ -0,0 +1,12 @@ +import React from 'react'; +import RadioButton from './RadioButton'; + +export default function RadioButtonExample() { + return ( + <> + + + + + ); +} diff --git a/src/components/Atoms/RichText/RichText.md b/src/components/Atoms/RichText/RichText.md deleted file mode 100644 index 4443a52c3..000000000 --- a/src/components/Atoms/RichText/RichText.md +++ /dev/null @@ -1,8 +0,0 @@ -# RichText - -```js -Some strong test markup

'} ->
-``` diff --git a/src/components/Atoms/RichText/RichText.test.js b/src/components/Atoms/RichText/RichText.test.js index 8568dabb5..71af0c1d0 100644 --- a/src/components/Atoms/RichText/RichText.test.js +++ b/src/components/Atoms/RichText/RichText.test.js @@ -14,11 +14,12 @@ it('It sanitises markup and renders properly', () => { .c0 { text-align: right; } - +
Here's some copy

More copy", } } diff --git a/src/components/Atoms/RichText/RichTextExample.jsx b/src/components/Atoms/RichText/RichTextExample.jsx new file mode 100644 index 000000000..6334dbe99 --- /dev/null +++ b/src/components/Atoms/RichText/RichTextExample.jsx @@ -0,0 +1,11 @@ +import React from 'react'; +import RichText from './RichText'; + +export default function RichTextExample() { + return ( + + ); +} diff --git a/src/components/Atoms/Select/Select.js b/src/components/Atoms/Select/Select.js index e52077d88..459326917 100644 --- a/src/components/Atoms/Select/Select.js +++ b/src/components/Atoms/Select/Select.js @@ -29,7 +29,7 @@ const StyledSelect = styled.select` color: ${({ theme, greyDescription, hasValue }) => (greyDescription && !hasValue ? 'grey' : theme.color('black'))}; border-radius: 0.5rem; cursor: pointer; - :focus { + &:focus { border: 1px solid ${({ theme }) => theme.color('grey_for_forms')}; } diff --git a/src/components/Atoms/Select/Select.md b/src/components/Atoms/Select/Select.md deleted file mode 100644 index 340b2fb0b..000000000 --- a/src/components/Atoms/Select/Select.md +++ /dev/null @@ -1,47 +0,0 @@ -# Select - -```js -

DROPDOWN MENU

- - -

DROPDOWN MENU - hide arrow / just one option

- + +

DROPDOWN MENU with error

+ + + ); +} diff --git a/src/components/Atoms/Select/__snapshots__/Select.test.js.snap b/src/components/Atoms/Select/__snapshots__/Select.test.js.snap index 5b243e437..30e96f9a7 100644 --- a/src/components/Atoms/Select/__snapshots__/Select.test.js.snap +++ b/src/components/Atoms/Select/__snapshots__/Select.test.js.snap @@ -5,9 +5,6 @@ exports[`renders correctly 1`] = ` font-family: 'Montserrat',Helvetica,Arial,sans-serif; font-weight: 400; text-transform: inherit; - -webkit-letter-spacing: 0; - -moz-letter-spacing: 0; - -ms-letter-spacing: 0; letter-spacing: 0; font-size: 1rem; line-height: 1.25rem; @@ -21,12 +18,7 @@ exports[`renders correctly 1`] = ` .c0 { width: 100%; position: relative; - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; display: flex; - -webkit-flex-direction: column; - -ms-flex-direction: column; flex-direction: column; color: #000000; } @@ -36,9 +28,6 @@ exports[`renders correctly 1`] = ` font-family: 'Montserrat',Helvetica,Arial,sans-serif; font-weight: 400; text-transform: inherit; - -webkit-letter-spacing: 0; - -moz-letter-spacing: 0; - -ms-letter-spacing: 0; letter-spacing: 0; font-size: 1rem; line-height: 1.25rem; @@ -60,8 +49,6 @@ exports[`renders correctly 1`] = ` border: 1px solid; border-color: #969598; box-shadow: none; - -webkit-appearance: none; - -moz-appearance: none; appearance: none; color: #000000; border-radius: 0.5rem; @@ -72,35 +59,35 @@ exports[`renders correctly 1`] = ` border: 1px solid #666; } -@media (min-width:740px) { +@media (min-width: 740px) { .c1 { font-size: 1rem; line-height: 1.25rem; } } -@media (min-width:1024px) { +@media (min-width: 1024px) { .c1 { font-size: 1.125rem; line-height: 1.375rem; } } -@media (min-width:740px) { +@media (min-width: 740px) { .c2 { font-size: 1rem; line-height: 1.25rem; } } -@media (min-width:1024px) { +@media (min-width: 1024px) { .c2 { font-size: 1rem; line-height: 1.25rem; } } -@media (min-width:740px) { +@media (min-width: 740px) { .c3 { max-width: 290px; } @@ -108,11 +95,13 @@ exports[`renders correctly 1`] = ` `; diff --git a/src/components/Atoms/SocialIcons/SocialIcons.md b/src/components/Atoms/SocialIcons/SocialIcons.md deleted file mode 100644 index 74c4e9f97..000000000 --- a/src/components/Atoms/SocialIcons/SocialIcons.md +++ /dev/null @@ -1,20 +0,0 @@ -### Comic Relief -```js -
- -
-``` - -### Red Nose Day -```js -
- -
-``` - -### Sport Relief with self target -```js -
- -
-``` diff --git a/src/components/Atoms/SocialIcons/SocialIconsExample.jsx b/src/components/Atoms/SocialIcons/SocialIconsExample.jsx new file mode 100644 index 000000000..0a1f50aac --- /dev/null +++ b/src/components/Atoms/SocialIcons/SocialIconsExample.jsx @@ -0,0 +1,29 @@ +import React from 'react'; +import styled from 'styled-components'; +import SocialIcons from './SocialIcons'; + +const ExampleWrapper = styled.div` + background: black; + padding: 10px; +`; + +export default function SocialIconsExample() { + return ( + <> +

Comic Relief

+ + + + +

Red Nose Day

+ + + + +

Sport Relief with self target

+ + + + + ); +} diff --git a/src/components/Atoms/SocialIcons/__snapshots__/SocialIcons.test.js.snap b/src/components/Atoms/SocialIcons/__snapshots__/SocialIcons.test.js.snap index f5ca90718..64af42f84 100644 --- a/src/components/Atoms/SocialIcons/__snapshots__/SocialIcons.test.js.snap +++ b/src/components/Atoms/SocialIcons/__snapshots__/SocialIcons.test.js.snap @@ -2,12 +2,10 @@ exports[`renders correctly with Comic Relief links 1`] = ` .c2 { - -webkit-text-decoration: none; text-decoration: none; cursor: pointer; display: block; position: relative; - -webkit-transition: opacity 0.2s; transition: opacity 0.2s; } @@ -21,32 +19,19 @@ exports[`renders correctly with Comic Relief links 1`] = ` } .c0 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; display: flex; - -webkit-flex-wrap: nowrap; - -ms-flex-wrap: nowrap; flex-wrap: nowrap; gap: 0; list-style-type: none; - -webkit-box-pack: start; - -webkit-justify-content: flex-start; - -ms-flex-pack: start; justify-content: flex-start; margin: 0 auto 0 0; padding: 0; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; align-items: center; } .c1 { width: 48px; height: auto; - -webkit-flex: 0 0 48px; - -ms-flex: 0 0 48px; flex: 0 0 48px; margin-right: 1.5rem; } @@ -55,17 +40,14 @@ exports[`renders correctly with Comic Relief links 1`] = ` width: auto; } -@media (min-width:740px) { +@media (min-width: 740px) { .c0 { - -webkit-box-pack: start; - -webkit-justify-content: start; - -ms-flex-pack: start; justify-content: start; margin: 0 auto 0 0; } } -@media (min-width:740px) { +@media (min-width: 740px) { .c1 { margin-right: 1.5rem; } @@ -73,14 +55,18 @@ exports[`renders correctly with Comic Relief links 1`] = `
  • @@ -151,12 +150,10 @@ exports[`renders correctly with Comic Relief links 1`] = ` exports[`renders correctly with Red Nose Day links and self target 1`] = ` .c2 { - -webkit-text-decoration: none; text-decoration: none; cursor: pointer; display: block; position: relative; - -webkit-transition: opacity 0.2s; transition: opacity 0.2s; } @@ -170,32 +167,19 @@ exports[`renders correctly with Red Nose Day links and self target 1`] = ` } .c0 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; display: flex; - -webkit-flex-wrap: nowrap; - -ms-flex-wrap: nowrap; flex-wrap: nowrap; gap: 0; list-style-type: none; - -webkit-box-pack: start; - -webkit-justify-content: flex-start; - -ms-flex-pack: start; justify-content: flex-start; margin: 0 auto 0 0; padding: 0; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; align-items: center; } .c1 { width: 48px; height: auto; - -webkit-flex: 0 0 48px; - -ms-flex: 0 0 48px; flex: 0 0 48px; margin-right: 1.5rem; } @@ -204,17 +188,14 @@ exports[`renders correctly with Red Nose Day links and self target 1`] = ` width: auto; } -@media (min-width:740px) { +@media (min-width: 740px) { .c0 { - -webkit-box-pack: start; - -webkit-justify-content: start; - -ms-flex-pack: start; justify-content: start; margin: 0 auto 0 0; } } -@media (min-width:740px) { +@media (min-width: 740px) { .c1 { margin-right: 1.5rem; } @@ -222,14 +203,18 @@ exports[`renders correctly with Red Nose Day links and self target 1`] = `
    • @@ -300,12 +298,10 @@ exports[`renders correctly with Red Nose Day links and self target 1`] = ` exports[`renders correctly with Sport Relief links 1`] = ` .c2 { - -webkit-text-decoration: none; text-decoration: none; cursor: pointer; display: block; position: relative; - -webkit-transition: opacity 0.2s; transition: opacity 0.2s; } @@ -319,32 +315,19 @@ exports[`renders correctly with Sport Relief links 1`] = ` } .c0 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; display: flex; - -webkit-flex-wrap: nowrap; - -ms-flex-wrap: nowrap; flex-wrap: nowrap; gap: 0; list-style-type: none; - -webkit-box-pack: start; - -webkit-justify-content: flex-start; - -ms-flex-pack: start; justify-content: flex-start; margin: 0 auto 0 0; padding: 0; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; align-items: center; } .c1 { width: 48px; height: auto; - -webkit-flex: 0 0 48px; - -ms-flex: 0 0 48px; flex: 0 0 48px; margin-right: 1.5rem; } @@ -353,17 +336,14 @@ exports[`renders correctly with Sport Relief links 1`] = ` width: auto; } -@media (min-width:740px) { +@media (min-width: 740px) { .c0 { - -webkit-box-pack: start; - -webkit-justify-content: start; - -ms-flex-pack: start; justify-content: start; margin: 0 auto 0 0; } } -@media (min-width:740px) { +@media (min-width: 740px) { .c1 { margin-right: 1.5rem; } @@ -371,14 +351,18 @@ exports[`renders correctly with Sport Relief links 1`] = `
      • diff --git a/src/components/Atoms/Text/Text.md b/src/components/Atoms/Text/Text.md deleted file mode 100644 index 8c8733f73..000000000 --- a/src/components/Atoms/Text/Text.md +++ /dev/null @@ -1,169 +0,0 @@ -```js -import fontConfig from '../../../theme/crTheme/fontConfig'; - -<> -
        - - H1 - - - family: {fontConfig['h1'].family} - - mobileColor: blue -
        - font size (S / M / L breakpoints): {fontConfig['h1'].small.fontSize} / {fontConfig['h1'].medium.fontSize} / {fontConfig['h1'].large.fontSize} -
        - line height (S / M / L breakpoints): {fontConfig['h1'].small.lineHeight} / {fontConfig['h1'].medium.lineHeight} / {fontConfig['h1'].large.lineHeight} -
        - - - H2 - - - family: {fontConfig['h2'].family} - - mobileColor: green -
        - font size (S / M / L breakpoints): {fontConfig['h2'].small.fontSize} / {fontConfig['h2'].medium.fontSize} / {fontConfig['h2'].large.fontSize} -
        - line height (S / M / L breakpoints): {fontConfig['h2'].small.lineHeight} / {fontConfig['h2'].medium.lineHeight} / {fontConfig['h2'].large.lineHeight} -
        - - - H3 - - - family: {fontConfig['h3'].family} - - mobileColor: red -
        - font size (S / M / L breakpoints): {fontConfig['h3'].small.fontSize} / {fontConfig['h3'].medium.fontSize} / {fontConfig['h3'].large.fontSize} -
        - line height (S / M / L breakpoints): {fontConfig['h3'].small.lineHeight} / {fontConfig['h3'].medium.lineHeight} / {fontConfig['h3'].large.lineHeight} -
        - - - H4 - - - family: {fontConfig['span'].family} - -
        - font size (S / M / L breakpoints): {fontConfig['h4'].small.fontSize} / {fontConfig['h4'].medium.fontSize} / {fontConfig['h4'].large.fontSize} -
        - line height (S / M / L breakpoints): {fontConfig['h4'].small.lineHeight} / {fontConfig['h4'].medium.lineHeight} / {fontConfig['h4'].large.lineHeight} -
        - - - P (body) - - - family: {fontConfig['p'].family} - -
        - font size (S / M / L breakpoints): {fontConfig['p'].small.fontSize} / {fontConfig['p'].medium.fontSize} / {fontConfig['p'].large.fontSize} -
        - line height (S / M / L breakpoints): {fontConfig['p'].small.lineHeight} / {fontConfig['p'].medium.lineHeight} / {fontConfig['p'].large.lineHeight} -
        - - - Tags to be phased out: - - - - H5 - - - family: {fontConfig['h5'].family} - -
        - font size (S / M / L breakpoints): {fontConfig['h5'].small.fontSize} / {fontConfig['h5'].medium.fontSize} / {fontConfig['h5'].large.fontSize} -
        - line height (S / M / L breakpoints): {fontConfig['h5'].small.lineHeight} / {fontConfig['h5'].medium.lineHeight} / {fontConfig['h5'].large.lineHeight} -
        - - - H6 - - - family: {fontConfig['h6'].family} -
        - font size (S / M / L breakpoints): {fontConfig['h6'].small.fontSize} / {fontConfig['h6'].medium.fontSize} / {fontConfig['h6'].large.fontSize} -
        - line height (S / M / L breakpoints): {fontConfig['h6'].small.lineHeight} / {fontConfig['h6'].medium.lineHeight} / {fontConfig['h6'].large.lineHeight} -
        -
        - -
        - - Context styles: - - -
        -

        First paragraph

        -

        Second paragraph

        -

        Third and final paragraph

        -
        - -
        -

        Only child P

        -
        - -
        -

        Only child H1

        -
        - -
        -

        First child H1

        -

        Second child H1

        -
        - -
        -

        h1

        -

        Paragraph

        -

        Paragraph

        -

        Paragraph, last child

        -
        - -
        -

        A preceding paragraph

        -

        A preceding paragraph

        -

        H1 with an added margin-top as it follows a p tag

        -

        Proceeding paragraph

        -

        Paragraph, last child

        -
        - -
        -

        A preceding paragraph

        -

        A preceding paragraph

        -

        H2 with an added margin-top as it follows a p tag

        -

        Proceeding paragraph

        -

        Paragraph, last child

        -
        - -
        - -``` diff --git a/src/components/Atoms/Text/TextExample.jsx b/src/components/Atoms/Text/TextExample.jsx new file mode 100644 index 000000000..9e52e8eda --- /dev/null +++ b/src/components/Atoms/Text/TextExample.jsx @@ -0,0 +1,135 @@ +import React from 'react'; +import Text from './Text'; +import fontConfig from '../../../theme/crTheme/fontConfig'; + +export default function TextExample() { + return ( + <> +
        + + H1 + + + family: {fontConfig['h1'].family} - + mobileColor: blue +
        + font size (S / M / L breakpoints): {fontConfig['h1'].small.fontSize} / {fontConfig['h1'].medium.fontSize} / {fontConfig['h1'].large.fontSize} +
        + line height (S / M / L breakpoints): {fontConfig['h1'].small.lineHeight} / {fontConfig['h1'].medium.lineHeight} / {fontConfig['h1'].large.lineHeight} +
        + + + H2 + + + family: {fontConfig['h2'].family} - + mobileColor: green +
        + font size (S / M / L breakpoints): {fontConfig['h2'].small.fontSize} / {fontConfig['h2'].medium.fontSize} / {fontConfig['h2'].large.fontSize} +
        + line height (S / M / L breakpoints): {fontConfig['h2'].small.lineHeight} / {fontConfig['h2'].medium.lineHeight} / {fontConfig['h2'].large.lineHeight} +
        + + + H3 + + + family: {fontConfig['h3'].family} - + mobileColor: red +
        + font size (S / M / L breakpoints): {fontConfig['h3'].small.fontSize} / {fontConfig['h3'].medium.fontSize} / {fontConfig['h3'].large.fontSize} +
        + line height (S / M / L breakpoints): {fontConfig['h3'].small.lineHeight} / {fontConfig['h3'].medium.lineHeight} / {fontConfig['h3'].large.lineHeight} +
        + + + H4 + + + family: {fontConfig['span'].family} - +
        + font size (S / M / L breakpoints): {fontConfig['h4'].small.fontSize} / {fontConfig['h4'].medium.fontSize} / {fontConfig['h4'].large.fontSize} +
        + line height (S / M / L breakpoints): {fontConfig['h4'].small.lineHeight} / {fontConfig['h4'].medium.lineHeight} / {fontConfig['h4'].large.lineHeight} +
        + + + P (body) + + + family: {fontConfig['p'].family} - +
        + font size (S / M / L breakpoints): {fontConfig['p'].small.fontSize} / {fontConfig['p'].medium.fontSize} / {fontConfig['p'].large.fontSize} +
        + line height (S / M / L breakpoints): {fontConfig['p'].small.lineHeight} / {fontConfig['p'].medium.lineHeight} / {fontConfig['p'].large.lineHeight} +
        + + + Tags to be phased out: + + + + H5 + + + family: {fontConfig['h5'].family} - +
        + font size (S / M / L breakpoints): {fontConfig['h5'].small.fontSize} / {fontConfig['h5'].medium.fontSize} / {fontConfig['h5'].large.fontSize} +
        + line height (S / M / L breakpoints): {fontConfig['h5'].small.lineHeight} / {fontConfig['h5'].medium.lineHeight} / {fontConfig['h5'].large.lineHeight} +
        + + + H6 + + + family: {fontConfig['h6'].family} +
        + font size (S / M / L breakpoints): {fontConfig['h6'].small.fontSize} / {fontConfig['h6'].medium.fontSize} / {fontConfig['h6'].large.fontSize} +
        + line height (S / M / L breakpoints): {fontConfig['h6'].small.lineHeight} / {fontConfig['h6'].medium.lineHeight} / {fontConfig['h6'].large.lineHeight} +
        +
        + +
        + + Context styles: + + +
        +

        First paragraph

        +

        Second paragraph

        +

        Third and final paragraph

        +
        + +
        +

        Only child P

        +
        + +
        +

        Only child H1

        +
        + +
        +

        First child H1

        +

        Second child H1

        +
        + +
        +

        h1

        +

        Paragraph

        +

        Paragraph

        +

        Paragraph, last child

        +
        + +
        +

        A preceding paragraph

        +

        A preceding paragraph

        +

        H1 with an added margin-top as it follows a p tag

        +

        Proceeding paragraph

        +

        Paragraph, last child

        +
        +
        + + ); +} diff --git a/src/components/Atoms/Text/__snapshots__/Text.test.js.snap b/src/components/Atoms/Text/__snapshots__/Text.test.js.snap index d087db840..ebc34caba 100644 --- a/src/components/Atoms/Text/__snapshots__/Text.test.js.snap +++ b/src/components/Atoms/Text/__snapshots__/Text.test.js.snap @@ -5,9 +5,6 @@ exports[`renders heavy heading correctly 1`] = ` font-family: 'Montserrat',Helvetica,Arial,sans-serif; font-weight: 700; text-transform: inherit; - -webkit-letter-spacing: 0; - -moz-letter-spacing: 0; - -ms-letter-spacing: 0; letter-spacing: 0; font-size: 1.25rem; line-height: 1.5rem; @@ -22,14 +19,14 @@ exports[`renders heavy heading correctly 1`] = ` line-height: inherit; } -@media (min-width:740px) { +@media (min-width: 740px) { .c0 { font-size: 1.25rem; line-height: 1.5rem; } } -@media (min-width:1024px) { +@media (min-width: 1024px) { .c0 { font-size: 1.375rem; line-height: 1.625rem; @@ -48,9 +45,6 @@ exports[`renders high heading correctly 1`] = ` font-family: 'Montserrat',Helvetica,Arial,sans-serif; font-weight: 700; text-transform: inherit; - -webkit-letter-spacing: 0; - -moz-letter-spacing: 0; - -ms-letter-spacing: 0; letter-spacing: 0; font-size: 1.25rem; line-height: 1.5rem; @@ -65,14 +59,14 @@ exports[`renders high heading correctly 1`] = ` line-height: inherit; } -@media (min-width:740px) { +@media (min-width: 740px) { .c0 { font-size: 1.25rem; line-height: 1.5rem; } } -@media (min-width:1024px) { +@media (min-width: 1024px) { .c0 { font-size: 1.375rem; line-height: 1.625rem; @@ -91,9 +85,6 @@ exports[`renders large heading correctly 1`] = ` font-family: 'Montserrat',Helvetica,Arial,sans-serif; font-weight: 700; text-transform: inherit; - -webkit-letter-spacing: 0; - -moz-letter-spacing: 0; - -ms-letter-spacing: 0; letter-spacing: 0; font-size: 1.25rem; line-height: 1.5rem; @@ -109,14 +100,14 @@ exports[`renders large heading correctly 1`] = ` line-height: inherit; } -@media (min-width:740px) { +@media (min-width: 740px) { .c0 { font-size: 1.25rem; line-height: 1.5rem; } } -@media (min-width:1024px) { +@media (min-width: 1024px) { .c0 { font-size: 1.375rem; line-height: 1.625rem; @@ -135,9 +126,6 @@ exports[`renders xl paragraph with Anton font correctly 1`] = ` font-family: 'Montserrat',Helvetica,Arial,sans-serif; font-weight: 400; text-transform: inherit; - -webkit-letter-spacing: 0; - -moz-letter-spacing: 0; - -ms-letter-spacing: 0; letter-spacing: 0; font-size: 1rem; line-height: 1.25rem; @@ -154,14 +142,14 @@ exports[`renders xl paragraph with Anton font correctly 1`] = ` line-height: inherit; } -@media (min-width:740px) { +@media (min-width: 740px) { .c0 { font-size: 1rem; line-height: 1.25rem; } } -@media (min-width:1024px) { +@media (min-width: 1024px) { .c0 { font-size: 1.125rem; line-height: 1.375rem; @@ -180,9 +168,6 @@ exports[`renders xl yellow paragraph correctly 1`] = ` font-family: 'Montserrat',Helvetica,Arial,sans-serif; font-weight: 400; text-transform: inherit; - -webkit-letter-spacing: 0; - -moz-letter-spacing: 0; - -ms-letter-spacing: 0; letter-spacing: 0; font-size: 1rem; line-height: 1.25rem; @@ -199,14 +184,14 @@ exports[`renders xl yellow paragraph correctly 1`] = ` line-height: inherit; } -@media (min-width:740px) { +@media (min-width: 740px) { .c0 { font-size: 1rem; line-height: 1.25rem; } } -@media (min-width:1024px) { +@media (min-width: 1024px) { .c0 { font-size: 1.125rem; line-height: 1.375rem; diff --git a/src/components/Atoms/TextArea/TextArea.md b/src/components/Atoms/TextArea/TextArea.md deleted file mode 100644 index c50ed7fa6..000000000 --- a/src/components/Atoms/TextArea/TextArea.md +++ /dev/null @@ -1,21 +0,0 @@ -# TextArea Field - -```js -

        Long copy/Message field

        -