diff --git a/__mocks__/styleMock.js b/__mocks__/styleMock.js new file mode 100644 index 00000000..3f32a8d9 --- /dev/null +++ b/__mocks__/styleMock.js @@ -0,0 +1,12 @@ +module.exports = new Proxy( + {}, + { + get: function getter(target, key) { + if (key === '__esModule') { + // True instead of false to pretend we're an ES module. + return true; + } + return key; + }, + } +); diff --git a/jest.config.js b/jest.config.js index 23eba575..14b0ca71 100644 --- a/jest.config.js +++ b/jest.config.js @@ -8,7 +8,8 @@ const customJestConfig = { coverageReporters: ['lcov', 'text'], testPathIgnorePatterns: ['/cypress/', '__tests__/mockdata/'], moduleNameMapper: { - '\\.(css|less|scss|sss|styl)$': 'identity-obj-proxy', + '^.+\\.(svg)$': '/__mocks__/fileMock.js', + '\\.(css|less|scss|sss|styl)$': '/__mocks__/styleMock.js', }, setupFilesAfterEnv: ['/jest.setup.ts'], testEnvironment: 'jest-environment-jsdom', @@ -23,19 +24,4 @@ const customJestConfig = { }, }; -/** - * We handle SVG in our own way instead of letting Next.js use next/image. - * @param {} config - * @returns - */ -const fdmgJestConfig = async (config) => { - const nextConfig = { ...config }; - nextConfig.moduleNameMapper = { - '^.+\\.(svg)$': '/__mocks__/fileMock.js', - ...nextConfig.moduleNameMapper, - }; - return nextConfig; -}; - -// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async -module.exports = fdmgJestConfig(customJestConfig); +module.exports = customJestConfig; diff --git a/package-lock.json b/package-lock.json index 8cb6448c..42131e8c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,7 +44,6 @@ "eslint-plugin-next": "^0.0.0", "eslint-plugin-prettier": "^5.1.3", "fetch-jsonp": "^1.3.0", - "identity-obj-proxy": "^3.0.0", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", "json-to-scss": "^1.6.2", @@ -6928,12 +6927,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/harmony-reflect": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/harmony-reflect/-/harmony-reflect-1.6.2.tgz", - "integrity": "sha512-HIp/n38R9kQjDEziXyDTuW3vvoxxyxjxFzXLrBr18uB47GnSt+G9D29fqrpM5ZkspMcPICud3XsBJQ4Y2URg8g==", - "dev": true - }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -7093,18 +7086,6 @@ "postcss": "^8.1.0" } }, - "node_modules/identity-obj-proxy": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/identity-obj-proxy/-/identity-obj-proxy-3.0.0.tgz", - "integrity": "sha512-00n6YnVHKrinT9t0d9+5yZC6UBNJANpYEQvL2LlX6Ab9lnmxzIRcEmTPuyGScvl1+jKuCICX1Z0Ab1pPKKdikA==", - "dev": true, - "dependencies": { - "harmony-reflect": "^1.4.6" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/ignore": { "version": "5.2.4", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", diff --git a/package.json b/package.json index 22a09010..f9c6e7cc 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,6 @@ "eslint-plugin-next": "^0.0.0", "eslint-plugin-prettier": "^5.1.3", "fetch-jsonp": "^1.3.0", - "identity-obj-proxy": "^3.0.0", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", "json-to-scss": "^1.6.2", diff --git a/pages/[section]/[id]/[title].tsx b/pages/[section]/[id]/[title].tsx index 9a127904..1beeaec8 100644 --- a/pages/[section]/[id]/[title].tsx +++ b/pages/[section]/[id]/[title].tsx @@ -1,7 +1,7 @@ import React, { useState, useEffect } from 'react'; import '@fdmg/css-grid/css/grid.css'; import '@fdmg/css-grid/css/flex.css'; -import styles from './Article.module.scss'; +import * as styles from './Article.module.scss'; import { mergeInlineContent } from '../../../src/utils/articleContent'; import PageStore from '../../../src/stores/PageStore'; import { OEmbedLoader } from '../../../src/utils/OEmbedLoader'; @@ -52,7 +52,7 @@ function Article(props: Props) { try { return ( -
+
@@ -79,7 +79,7 @@ function Article(props: Props) { ]} > @@ -92,7 +92,7 @@ function Article(props: Props) { />

{props.json.title}

-

+

{props.json.intro}

@@ -110,12 +110,12 @@ function Article(props: Props) { /> @@ -131,7 +131,7 @@ function Article(props: Props) { ]} > @@ -140,10 +140,12 @@ function Article(props: Props) { - + AD diff --git a/pages/_app.tsx b/pages/_app.tsx index 220ec7d7..7800bb8d 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -7,7 +7,7 @@ import '../src/design-tokens/design-tokens.scss'; import './_app.scss'; import './_app_markdown.scss'; import './_app_a11y-dark.scss'; -import styles from './_app.module.scss'; +import * as styles from './_app.module.scss'; import PageStore, { Page } from '../src/stores/PageStore'; import Head from 'next/head'; import { Tooltip } from '../src/components/Tooltip'; @@ -66,7 +66,7 @@ function App({ Component, pageProps }) { const [loggedIn, setLoggedIn] = useState(false); const [pageType, setPageType] = useState(PageStore.getPageType()); - const [pageStyle, setPageStyle] = useState(styles.overview); + const [pageStyle, setPageStyle] = useState(styles['overview']); const darkModeMediaQuery = typeof window !== 'undefined' ? window?.matchMedia('(prefers-color-scheme: dark)') @@ -103,11 +103,11 @@ function App({ Component, pageProps }) { useEffect(() => { switch (pageType) { case 'article': - setPageStyle(styles.article); + setPageStyle(styles['article']); break; case 'overview': default: - setPageStyle(styles.overview); + setPageStyle(styles['overview']); } }, [pageType]); diff --git a/pages/ab.tsx b/pages/ab.tsx index d0c9542d..60c7947c 100644 --- a/pages/ab.tsx +++ b/pages/ab.tsx @@ -1,7 +1,7 @@ import React, { useState } from 'react'; import { ABProvider, Experiment, Variant } from '../src/components/ab/ab'; import { parseCookies } from 'nookies'; -import styles from './ab.module.scss'; +import * as styles from './ab.module.scss'; import { GetServerSidePropsContext } from 'next'; import Head from 'next/head'; @@ -22,7 +22,7 @@ function Demo(props: Props) { } return ( -
+
{`${metaTitle} - Design System - Het Financieele Dagblad`} diff --git a/pages/article-bullet-point.tsx b/pages/article-bullet-point.tsx index ab9b48f4..03a6999d 100644 --- a/pages/article-bullet-point.tsx +++ b/pages/article-bullet-point.tsx @@ -5,7 +5,7 @@ import { getCssClassNames, } from '../src/components/bullet-point/BulletPoint'; import PageStore from '../src/stores/PageStore'; -import styles from './article-bullet-point.module.scss'; +import * as styles from './article-bullet-point.module.scss'; import Head from 'next/head'; import { globalCssClassNames } from '../src/utils/globalCssClassNames'; @@ -52,7 +52,7 @@ function Page() { <Explain anchor="default" cssClassNames={[...getCssClassNames(), ...globalCssClassNames]} - previewClassName={styles.preview} + previewClassName={styles['preview']} legend="Bullet point" reactComponentName="BulletPoint" description={ @@ -68,7 +68,7 @@ function Page() { <Explain anchor="align-right" cssClassNames={[...getCssClassNames(), ...globalCssClassNames]} - previewClassName={styles.preview} + previewClassName={styles['preview']} legend="Bullet point (align: right)" reactComponentName="BulletPoint" description={ @@ -84,7 +84,7 @@ function Page() { <Explain anchor="variant-1" cssClassNames={[...getCssClassNames(), ...globalCssClassNames]} - previewClassName={styles.preview} + previewClassName={styles['preview']} legend="Summary (variant-1)" reactComponentName="BulletPoint" description={ @@ -100,7 +100,7 @@ function Page() { <Explain anchor="variant-1-align-right" cssClassNames={[...getCssClassNames(), ...globalCssClassNames]} - previewClassName={styles.preview} + previewClassName={styles['preview']} legend="Bullet point (variant-1, align: right)" reactComponentName="BulletPoint" description={ diff --git a/pages/article-link-block.tsx b/pages/article-link-block.tsx index 71cbf643..36d9c843 100644 --- a/pages/article-link-block.tsx +++ b/pages/article-link-block.tsx @@ -5,7 +5,7 @@ import { getCssClassNames, } from '../src/components/article-link-block/LinkBlock'; import PageStore from '../src/stores/PageStore'; -import styles from './article-link-block.module.scss'; +import * as styles from './article-link-block.module.scss'; import Head from 'next/head'; import { globalCssClassNames } from '../src/utils/globalCssClassNames'; @@ -44,7 +44,7 @@ function Page() { <Explain anchor="default" cssClassNames={[...getCssClassNames(), ...globalCssClassNames]} - previewClassName={styles.preview} + previewClassName={styles['preview']} legend="Link Block" reactComponentName="LinkBlock" description={ @@ -64,7 +64,7 @@ function Page() { <Explain anchor="align-right" cssClassNames={[...getCssClassNames(), ...globalCssClassNames]} - previewClassName={styles.preview} + previewClassName={styles['preview']} legend="Link Block (align: right)" reactComponentName="LinkBlock" description={ diff --git a/pages/article-tags.tsx b/pages/article-tags.tsx index a0a0740f..61c77f8e 100644 --- a/pages/article-tags.tsx +++ b/pages/article-tags.tsx @@ -4,7 +4,7 @@ import { ArticleTags, getCssClassNames, } from '../src/components/article-tags/ArticleTags'; -import styles from './article-link-block.module.scss'; +import * as styles from './article-link-block.module.scss'; import PageStore from '../src/stores/PageStore'; import Head from 'next/head'; import { globalCssClassNames } from '../src/utils/globalCssClassNames'; @@ -112,7 +112,7 @@ function Page() { <Explain cssClassNames={[...getCssClassNames(), ...globalCssClassNames]} - previewClassName={styles.preview} + previewClassName={styles['preview']} legend="Article tags" description={ <> diff --git a/pages/author-info.tsx b/pages/author-info.tsx index 8d803f1e..26f69af9 100644 --- a/pages/author-info.tsx +++ b/pages/author-info.tsx @@ -4,7 +4,7 @@ import { AuthorInfo, getCssClassNames, } from '../src/components/author-info/AuthorInfo'; -import styles from './article-link-block.module.scss'; +import * as styles from './article-link-block.module.scss'; import Head from 'next/head'; import { globalCssClassNames } from '../src/utils/globalCssClassNames'; @@ -36,7 +36,7 @@ function Page() { <Explain cssClassNames={[...getCssClassNames(), ...globalCssClassNames]} - previewClassName={styles.preview} + previewClassName={styles['preview']} legend="Author Info" reactComponentName="AuthorInfo" description={ diff --git a/pages/button/button.tsx b/pages/button/button.tsx index 425dbb9b..ce9152d1 100644 --- a/pages/button/button.tsx +++ b/pages/button/button.tsx @@ -3,7 +3,7 @@ import { Explain } from '../../src/components/Explain'; import { Button, getCssClassNames } from '../../src/components/button/Button'; import Head from 'next/head'; import { EnvelopeIcon } from '../../src/design-tokens/icons'; -import styles from './buttons.module.scss'; +import * as styles from './buttons.module.scss'; import { globalCssClassNames } from '../../src/utils/globalCssClassNames'; export const metaTitle = 'Neutral Button'; @@ -28,7 +28,7 @@ function Page() { </Head> <Explain - previewClassName={styles.buttons} + previewClassName={styles['buttons']} anchor="default" cssClassNames={[...getCssClassNames(), ...globalCssClassNames]} legend="Button Neutral (default)" @@ -65,7 +65,7 @@ function Page() { </Explain> <Explain - previewClassName={styles.buttons} + previewClassName={styles['buttons']} anchor="m" cssClassNames={[...getCssClassNames(), ...globalCssClassNames]} legend="Button Neutral (M)" diff --git a/pages/button/cta.tsx b/pages/button/cta.tsx index 28d3e6a5..0f2d6daa 100644 --- a/pages/button/cta.tsx +++ b/pages/button/cta.tsx @@ -6,7 +6,7 @@ import { } from '../../src/components/button/ButtonCta'; import Head from 'next/head'; import { EnvelopeIcon } from '../../src/design-tokens/icons'; -import styles from './buttons.module.scss'; +import * as styles from './buttons.module.scss'; import { globalCssClassNames } from '../../src/utils/globalCssClassNames'; export const metaTitle = 'Button call-to-action'; @@ -31,7 +31,7 @@ function Page() { </Head> <Explain - previewClassName={styles.buttons} + previewClassName={styles['buttons']} anchor="default" cssClassNames={[...getCssClassNames(), ...globalCssClassNames]} legend="Button CTA (default)" @@ -89,7 +89,7 @@ function Page() { </Explain> <Explain - previewClassName={styles.buttons} + previewClassName={styles['buttons']} anchor="m" cssClassNames={[...getCssClassNames(), ...globalCssClassNames]} legend="Button CTA (M)" diff --git a/pages/button/ghost.tsx b/pages/button/ghost.tsx index a9a60781..b94f178e 100644 --- a/pages/button/ghost.tsx +++ b/pages/button/ghost.tsx @@ -6,7 +6,7 @@ import { } from '../../src/components/button/ButtonGhost'; import Head from 'next/head'; import { EnvelopeIcon } from '../../src/design-tokens/icons'; -import styles from './buttons.module.scss'; +import * as styles from './buttons.module.scss'; import { globalCssClassNames } from '../../src/utils/globalCssClassNames'; export const metaTitle = 'Ghost Button'; @@ -31,7 +31,7 @@ function Page() { </Head> <Explain - previewClassName={styles.buttons} + previewClassName={styles['buttons']} anchor="default" cssClassNames={[...getCssClassNames(), ...globalCssClassNames]} legend="Ghost Button (default)" @@ -85,7 +85,7 @@ function Page() { </Explain> <Explain - previewClassName={styles.buttons} + previewClassName={styles['buttons']} anchor="m" cssClassNames={[...getCssClassNames(), ...globalCssClassNames]} legend="Ghost Button (M)" diff --git a/pages/card/horizontal-1.tsx b/pages/card/horizontal-1.tsx index 2c6d399a..6fb2aafa 100644 --- a/pages/card/horizontal-1.tsx +++ b/pages/card/horizontal-1.tsx @@ -6,7 +6,7 @@ import { } from '../../src/components/card/HorizontalCard1'; import Head from 'next/head'; import { globalCssClassNames } from '../../src/utils/globalCssClassNames'; -import styles from './cards.module.scss'; +import * as styles from './cards.module.scss'; import { FdImgix } from '../../src/components/utils/image/FdImgix'; const horizontalCards1: any = [ @@ -90,7 +90,7 @@ function Page() { </Head> <Explain - previewClassName={`${styles.horizontalGrid} grid`} + previewClassName={`${styles['horizontalGrid']} grid`} anchor="horizontal1" cssClassNames={[...getCssClassNames(), ...globalCssClassNames]} legend="Horizontal Card 1" diff --git a/pages/card/horizontal-2.tsx b/pages/card/horizontal-2.tsx index ca5d66a9..714be062 100644 --- a/pages/card/horizontal-2.tsx +++ b/pages/card/horizontal-2.tsx @@ -6,7 +6,7 @@ import { } from '../../src/components/card/HorizontalCard2'; import Head from 'next/head'; import { globalCssClassNames } from '../../src/utils/globalCssClassNames'; -import styles from './cards.module.scss'; +import * as styles from './cards.module.scss'; const horizontalCards2: any = [ { @@ -60,7 +60,7 @@ function Page() { </Head> <Explain - previewClassName={`${styles.horizontalGrid} grid`} + previewClassName={`${styles['horizontalGrid']} grid`} anchor="horizontal2" cssClassNames={[...getCssClassNames(), ...globalCssClassNames]} legend="Horizontal Card 2" diff --git a/pages/card/horizontal-3.tsx b/pages/card/horizontal-3.tsx index d3616a36..84a50aad 100644 --- a/pages/card/horizontal-3.tsx +++ b/pages/card/horizontal-3.tsx @@ -6,7 +6,7 @@ import { } from '../../src/components/card/HorizontalCard3'; import Head from 'next/head'; import { globalCssClassNames } from '../../src/utils/globalCssClassNames'; -import styles from './cards.module.scss'; +import * as styles from './cards.module.scss'; import { FdImgix } from '../../src/components/utils/image/FdImgix'; const horizontalCards3: any = [ @@ -60,7 +60,7 @@ function Page() { </Head> <Explain - previewClassName={`${styles.horizontalGrid} grid`} + previewClassName={`${styles['horizontalGrid']} grid`} anchor="horizontal3" cssClassNames={[...getCssClassNames(), ...globalCssClassNames]} legend="Horizontal Card 3" diff --git a/pages/card/horizontal-4.tsx b/pages/card/horizontal-4.tsx index 344fc02f..0e2694d9 100644 --- a/pages/card/horizontal-4.tsx +++ b/pages/card/horizontal-4.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { Explain } from '../../src/components/Explain'; import Head from 'next/head'; import { globalCssClassNames } from '../../src/utils/globalCssClassNames'; -import styles from './cards.module.scss'; +import * as styles from './cards.module.scss'; import { HorizontalCard4, getCssClassNames, @@ -64,7 +64,7 @@ function Page() { </Head> <Explain - previewClassName={`${styles.horizontalGrid} ${styles.autoMinHeight} grid`} + previewClassName={`${styles['horizontalGrid']} ${styles['autoMinHeight']} grid`} anchor="horizontal4" cssClassNames={[...getCssClassNames(), ...globalCssClassNames]} legend="Horizontal Card 4" diff --git a/pages/card/hybrid-1.tsx b/pages/card/hybrid-1.tsx index cf7753ba..49bd4eb8 100644 --- a/pages/card/hybrid-1.tsx +++ b/pages/card/hybrid-1.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import styles from './cards.module.scss'; +import * as styles from './cards.module.scss'; import { Explain } from '../../src/components/Explain'; import { HybridCard1, @@ -78,7 +78,7 @@ function Page() { </Head> <Explain - previewClassName={`${styles.hybrid1Grid} grid`} + previewClassName={`${styles['hybrid1Grid']} grid`} anchor="hybrid1" cssClassNames={[...getCssClassNames(), ...globalCssClassNames]} legend="Hybrid Card 1" diff --git a/pages/card/hybrid-2.tsx b/pages/card/hybrid-2.tsx index 05ba4d1d..29021860 100644 --- a/pages/card/hybrid-2.tsx +++ b/pages/card/hybrid-2.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import styles from './cards.module.scss'; +import * as styles from './cards.module.scss'; import { Explain } from '../../src/components/Explain'; import { HybridCard2, @@ -78,7 +78,7 @@ function Page() { </Head> <Explain - previewClassName={`${styles.hybrid2Grid} grid`} + previewClassName={`${styles['hybrid2Grid']} grid`} anchor="hybrid2" cssClassNames={[...getCssClassNames(), ...globalCssClassNames]} legend="Hybrid Card 2" diff --git a/pages/card/hybrid-4.tsx b/pages/card/hybrid-4.tsx index f3278a9a..cd890633 100644 --- a/pages/card/hybrid-4.tsx +++ b/pages/card/hybrid-4.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { Explain } from '../../src/components/Explain'; import Head from 'next/head'; import { globalCssClassNames } from '../../src/utils/globalCssClassNames'; -import styles from './cards.module.scss'; +import * as styles from './cards.module.scss'; import { HybridCard4, getCssClassNames, @@ -61,7 +61,7 @@ function Page() { <Explain anchor="hybrid4" - previewClassName={`${styles.autoMinHeight} grid`} + previewClassName={`${styles['autoMinHeight']} grid`} cssClassNames={[...getCssClassNames(), ...globalCssClassNames]} legend="Hybrid Card 4" reactComponentName="HybridCard4" diff --git a/pages/cards.tsx b/pages/cards.tsx index efc59a4e..8317252e 100644 --- a/pages/cards.tsx +++ b/pages/cards.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import styles from './cards.module.scss'; +import * as styles from './cards.module.scss'; import Link from 'next/link'; import Head from 'next/head'; @@ -23,7 +23,7 @@ function Page() { /> </Head> <h1>Table of Contents</h1> - <table className={styles.table}> + <table className={styles['table']}> <thead> <tr> <td>Card</td> diff --git a/pages/cookieconsent.tsx b/pages/cookieconsent.tsx index 1fc09c6f..6822df6f 100644 --- a/pages/cookieconsent.tsx +++ b/pages/cookieconsent.tsx @@ -1,6 +1,6 @@ import React, { useState, useCallback, useEffect } from 'react'; import Script from 'next/script'; -import styles from './cookieconsent.module.scss'; +import * as styles from './cookieconsent.module.scss'; import { Explain } from '../src/components/Explain'; import Head from 'next/head'; import { Switch } from '../src/components/input/Switch'; @@ -67,7 +67,7 @@ function Page() { }, []); return ( - <div className={styles.cookieConsent}> + <div className={styles['cookieConsent']}> <Head> <title> {`${metaTitle} - Design System - Het Financieele Dagblad`} @@ -485,8 +485,8 @@ async function checkCookieconsent() { </> } title={ - <header className={styles.header}> - <span className={styles.icon}> + <header className={styles['header']}> + <span className={styles['icon']}> <FdmgIcon /> </span> </header> diff --git a/pages/fd-web/index.tsx b/pages/fd-web/index.tsx index 76e1d407..18151d46 100644 --- a/pages/fd-web/index.tsx +++ b/pages/fd-web/index.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import styles from './index.module.scss'; +import * as styles from './index.module.scss'; import '@fdmg/css-grid/css/grid.css'; import '@fdmg/css-grid/css/flex.css'; import { VerticalCard1 } from '../../src/components/card/VerticalCard1'; @@ -21,7 +21,7 @@ function Page(props: Props) { try { return ( - <section className={styles.page}> + <section className={styles['page']}> <Head> <meta name="robots" content="noindex" /> </Head> @@ -35,12 +35,12 @@ function Page(props: Props) { <GridContainer attributes={['xs-12', 'grid']}> {singleOpeningTeaser && ( <GridContainer - className={`ie-full-height ${styles.ie11FullHeight}`} + className={`ie-full-height ${styles['ie11FullHeight']}`} attributes={['xs-12', 'gap-bottom']} > <VerticalCard1 id={singleOpeningTeaser.id} - className={`${styles.newsContainer} ${styles.fullHeight}`} + className={`${styles['newsContainer']} ${styles['fullHeight']}`} caption={singleOpeningTeaser?.title} intro={singleOpeningTeaser?.intro} label={ @@ -60,7 +60,7 @@ function Page(props: Props) { (teaser) => ( <GridContainer key={`primary-${teaser.id}`} - className={`ie-full-height ${styles.ie11FullHeight}`} + className={`ie-full-height ${styles['ie11FullHeight']}`} attributes={[ 'xs-12', 's-6', @@ -72,7 +72,7 @@ function Page(props: Props) { > <VerticalCard1 id={teaser.id} - className={`${styles.newsContainer} ${styles.fullHeight}`} + className={`${styles['newsContainer']} ${styles['fullHeight']}`} caption={teaser?.title} intro={teaser?.intro} label={ @@ -92,7 +92,7 @@ function Page(props: Props) { (teaser) => ( <GridContainer key={`primary-${teaser.id}`} - className={`ie-full-height ${styles.ie11FullHeight}`} + className={`ie-full-height ${styles['ie11FullHeight']}`} attributes={[ 'xs-12', 's-6', @@ -104,7 +104,7 @@ function Page(props: Props) { > <VerticalCard1 id={teaser.id} - className={`${styles.newsContainer} ${styles.fullHeight}`} + className={`${styles['newsContainer']} ${styles['fullHeight']}`} caption={teaser?.title} intro={teaser?.intro} label={ @@ -124,7 +124,7 @@ function Page(props: Props) { (teaser) => ( <GridContainer key={`primary-${teaser.id}`} - className={`ie-full-height ${styles.ie11FullHeight}`} + className={`ie-full-height ${styles['ie11FullHeight']}`} attributes={[ 'xs-12', 's-6', @@ -136,7 +136,7 @@ function Page(props: Props) { > <VerticalCard1 id={teaser.id} - className={`${styles.newsContainer} ${styles.fullHeight}`} + className={`${styles['newsContainer']} ${styles['fullHeight']}`} caption={teaser?.title} intro={teaser?.intro} label={ @@ -156,7 +156,7 @@ function Page(props: Props) { (teaser) => ( <GridContainer key={`primary-${teaser.id}`} - className={`ie-full-height ${styles.ie11FullHeight}`} + className={`ie-full-height ${styles['ie11FullHeight']}`} attributes={[ 'xs-12', 's-6', @@ -168,7 +168,7 @@ function Page(props: Props) { > <VerticalCard1 id={teaser.id} - className={`${styles.newsContainer} ${styles.fullHeight}`} + className={`${styles['newsContainer']} ${styles['fullHeight']}`} caption={teaser?.title} intro={teaser?.intro} label={ @@ -187,13 +187,13 @@ function Page(props: Props) { </GridContainer> </GridContainer> <GridContainer - className={`${styles.fullHeight}`} + className={`${styles['fullHeight']}`} attributes={['xs-12', 'l-3', 'gap-1', 'gap-bottom']} > <div className={`dummy-card full-width`}> latest news </div> - <span className={`${styles.sticky} hide-lt-xl`}> + <span className={`${styles['sticky']} hide-lt-xl`}> AD </span> </GridContainer> @@ -237,7 +237,7 @@ function Page(props: Props) { return ( <GridContainer key={`${sectionModel.defaultCategoryModel.title}-${card.id}`} - className={`ie-full-height ${styles.ie11FullHeight}`} + className={`ie-full-height ${styles['ie11FullHeight']}`} attributes={[ 'xs-12', 's-6', @@ -249,7 +249,7 @@ function Page(props: Props) { > <HybridCard1 id={card.id} - className={`${styles.newsContainer} ${styles.fullHeight}`} + className={`${styles['newsContainer']} ${styles['fullHeight']}`} caption={ card?.title } @@ -270,7 +270,7 @@ function Page(props: Props) { return ( <GridContainer key={`${sectionModel.defaultCategoryModel.title}-${card.id}`} - className={`ie-full-height ${styles.ie11FullHeight}`} + className={`ie-full-height ${styles['ie11FullHeight']}`} attributes={[ 'xs-12', 's-6', @@ -282,7 +282,7 @@ function Page(props: Props) { > <HybridCard2 id={card.id} - className={`${styles.newsContainer} ${styles.fullHeight}`} + className={`${styles['newsContainer']} ${styles['fullHeight']}`} caption={ card?.title } diff --git a/pages/grid.tsx b/pages/grid.tsx index 935577d0..aad74d85 100644 --- a/pages/grid.tsx +++ b/pages/grid.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { Explain } from '../src/components/Explain'; import Head from 'next/head'; -import styles from './grid.module.scss'; +import * as styles from './grid.module.scss'; import { GridContainer } from '@fdmg/css-grid/GridContainer'; import { globalCssClassNames } from '../src/utils/globalCssClassNames'; @@ -38,7 +38,7 @@ function Page() { > <GridContainer attributes={['grid']}> <GridContainer - className={styles.dummyElement} + className={styles['dummyElement']} attributes={[ 'xs-12', 's-12', @@ -50,7 +50,7 @@ function Page() { /> <GridContainer - className={styles.dummyElement} + className={styles['dummyElement']} attributes={[ 'xs-12', 's-6', @@ -62,7 +62,7 @@ function Page() { ]} /> <GridContainer - className={styles.dummyElement} + className={styles['dummyElement']} attributes={[ 'xs-12', 's-6', @@ -75,7 +75,7 @@ function Page() { /> <GridContainer - className={styles.dummyElement} + className={styles['dummyElement']} attributes={[ 'xs-12', 'xs-hide', @@ -89,7 +89,7 @@ function Page() { ]} /> <GridContainer - className={styles.dummyElement} + className={styles['dummyElement']} attributes={[ 'xs-12', 'xs-hide', @@ -103,7 +103,7 @@ function Page() { ]} /> <GridContainer - className={styles.dummyElement} + className={styles['dummyElement']} attributes={[ 'xs-12', 'xs-hide', @@ -117,7 +117,7 @@ function Page() { /> <GridContainer - className={styles.dummyElement} + className={styles['dummyElement']} attributes={[ 'xs-12', 'xs-hide', @@ -130,7 +130,7 @@ function Page() { ]} /> <GridContainer - className={styles.dummyElement} + className={styles['dummyElement']} attributes={[ 'xs-12', 'xs-hide', @@ -143,7 +143,7 @@ function Page() { ]} /> <GridContainer - className={styles.dummyElement} + className={styles['dummyElement']} attributes={[ 'xs-12', 'xs-hide', @@ -156,7 +156,7 @@ function Page() { ]} /> <GridContainer - className={styles.dummyElement} + className={styles['dummyElement']} attributes={[ 'xs-12', 'xs-hide', @@ -170,7 +170,7 @@ function Page() { /> <GridContainer - className={styles.dummyElement} + className={styles['dummyElement']} attributes={[ 'xs-12', 'xs-hide', @@ -183,7 +183,7 @@ function Page() { /> <GridContainer - className={styles.dummyElement} + className={styles['dummyElement']} attributes={[ 'xs-12', 's-6', @@ -195,7 +195,7 @@ function Page() { ]} /> <GridContainer - className={styles.dummyElement} + className={styles['dummyElement']} attributes={[ 'xs-12', 's-6', @@ -208,7 +208,7 @@ function Page() { /> <GridContainer - className={styles.dummyElement} + className={styles['dummyElement']} attributes={[ 'xs-12', 's-4', @@ -220,7 +220,7 @@ function Page() { ]} /> <GridContainer - className={styles.dummyElement} + className={styles['dummyElement']} attributes={[ 'xs-12', 's-4', @@ -232,7 +232,7 @@ function Page() { ]} /> <GridContainer - className={styles.dummyElement} + className={styles['dummyElement']} attributes={[ 'xs-12', 's-4', @@ -245,7 +245,7 @@ function Page() { /> <GridContainer - className={styles.dummyElement} + className={styles['dummyElement']} attributes={[ 'xs-12', 's-3', @@ -257,7 +257,7 @@ function Page() { ]} /> <GridContainer - className={styles.dummyElement} + className={styles['dummyElement']} attributes={[ 'xs-12', 's-3', @@ -269,7 +269,7 @@ function Page() { ]} /> <GridContainer - className={styles.dummyElement} + className={styles['dummyElement']} attributes={[ 'xs-12', 's-3', @@ -293,7 +293,7 @@ function Page() { ]} > <GridContainer - className={styles.dummyElement} + className={styles['dummyElement']} attributes={[ 'xs-12', 's-12', @@ -305,7 +305,7 @@ function Page() { /> <GridContainer - className={styles.dummyElement} + className={styles['dummyElement']} attributes={[ 'xs-12', 's-6', @@ -317,7 +317,7 @@ function Page() { ]} /> <GridContainer - className={styles.dummyElement} + className={styles['dummyElement']} attributes={[ 'xs-12', 's-6', @@ -330,7 +330,7 @@ function Page() { /> <GridContainer - className={styles.dummyElement} + className={styles['dummyElement']} attributes={[ 'xs-12', 's-4', @@ -342,7 +342,7 @@ function Page() { ]} /> <GridContainer - className={styles.dummyElement} + className={styles['dummyElement']} attributes={[ 'xs-12', 's-4', @@ -354,7 +354,7 @@ function Page() { ]} /> <GridContainer - className={styles.dummyElement} + className={styles['dummyElement']} attributes={[ 'xs-12', 's-4', @@ -367,7 +367,7 @@ function Page() { /> <GridContainer - className={styles.dummyElement} + className={styles['dummyElement']} attributes={[ 'xs-12', 's-3', @@ -379,7 +379,7 @@ function Page() { ]} /> <GridContainer - className={styles.dummyElement} + className={styles['dummyElement']} attributes={[ 'xs-12', 's-3', @@ -391,7 +391,7 @@ function Page() { ]} /> <GridContainer - className={styles.dummyElement} + className={styles['dummyElement']} attributes={[ 'xs-12', 's-3', @@ -403,7 +403,7 @@ function Page() { ]} /> <GridContainer - className={styles.dummyElement} + className={styles['dummyElement']} attributes={[ 'xs-12', 's-3', diff --git a/pages/hall-of-fame/jorien-beukers.tsx b/pages/hall-of-fame/jorien-beukers.tsx index 02226f58..83980b0e 100644 --- a/pages/hall-of-fame/jorien-beukers.tsx +++ b/pages/hall-of-fame/jorien-beukers.tsx @@ -1,6 +1,6 @@ import React, { useEffect } from 'react'; -import styles from './Styles.module.scss'; -import articleStyles from '../[section]/[id]/Article.module.scss'; +import * as styles from './Styles.module.scss'; +import * as articleStyles from '../[section]/[id]/Article.module.scss'; import { Quote } from '../../src/components/quote/Quote'; import { NumberFrame } from '../../src/components/numberframe/NumberFrame'; import { WordFrame } from '../../src/components/wordframe/WordFrame'; @@ -67,14 +67,14 @@ function JorienBeukers() { </Head> <article - className={`${styles.hallOfFame} ${articleStyles.article}`} + className={`${styles['hallOfFame']} ${articleStyles['article']}`} > <header> <h1>JBreaking News</h1> </header> <ArticleMeta authors={[{ id: 1, fullName: 'Carlo M.' }]} /> - <div className={styles.embedContainer}> + <div className={styles['embedContainer']}> <iframe width="560" height="315" diff --git a/pages/modal.tsx b/pages/modal.tsx index 4f04eae3..d8e35416 100644 --- a/pages/modal.tsx +++ b/pages/modal.tsx @@ -3,7 +3,7 @@ import { Explain } from '../src/components/Explain'; import { Modal, getCssClassNames } from '../src/components/modal/Modal'; import Head from 'next/head'; import { Switch } from '../src/components/input/Switch'; -import styles from './modal.module.scss'; +import * as styles from './modal.module.scss'; import { globalCssClassNames } from '../src/utils/globalCssClassNames'; import { ButtonCta } from '../src/deno'; @@ -61,7 +61,7 @@ function Page() { } > <Modal - contentBoxClassName={styles.modal} + contentBoxClassName={styles['modal']} opened={opened} onClose={handleModalClose} > diff --git a/pages/search.tsx b/pages/search.tsx index bc5e5244..3f8d6e4f 100644 --- a/pages/search.tsx +++ b/pages/search.tsx @@ -7,7 +7,7 @@ import { GridContainer } from '@fdmg/css-grid/GridContainer'; import Head from 'next/head'; import { useRouter } from 'next/router'; import React, { useEffect, useState } from 'react'; -import styles from './search.module.scss'; +import * as styles from './search.module.scss'; import { metaTitle as abTitle, metaDescription as abDescription } from './ab'; import { @@ -423,14 +423,17 @@ export default function Page() { useEffect(() => { const observer = new MutationObserver(() => { interceptLinks( - document.querySelectorAll(`.${styles.searchResults} a[href]`) + document.querySelectorAll(`.${styles['searchResults']} a[href]`) ); }); - observer.observe(document.querySelector(`.${styles.searchResults}`), { - attributes: true, - childList: true, - subtree: true, - }); + observer.observe( + document.querySelector(`.${styles['searchResults']}`), + { + attributes: true, + childList: true, + subtree: true, + } + ); return () => { observer.disconnect(); }; @@ -457,7 +460,7 @@ export default function Page() { }, [searchString]); return ( - <section className={styles.search}> + <section className={styles['search']}> <Head> <title>Search - Design System - Het Financieele Dagblad @@ -489,12 +492,12 @@ export default function Page() { action="/search" onSubmit={handleSearchSubmit} > -
+
{searchString ? ( {results?.length ?

{results.length} Results

: null} -
+
{results.map((result, idx) => { const path = `${result[0]}`; const title = result[1].title; diff --git a/pages/tokens.tsx b/pages/tokens.tsx index 0b84fafe..312fbb68 100644 --- a/pages/tokens.tsx +++ b/pages/tokens.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import styles from './tokens.module.scss'; +import * as styles from './tokens.module.scss'; import fs from 'fs'; import path from 'path'; import Head from 'next/head'; @@ -22,7 +22,7 @@ function Tokens(props: Props) { } const colorGroups = Object.entries(colors.colors).map((colors) => ( -
+

{colors[0]}

{Object.entries(colors[1]).map((value) => { @@ -30,7 +30,7 @@ function Tokens(props: Props) {