diff --git a/docusaurus.config.js b/docusaurus.config.js index 25fa433aa76..bdd8059a392 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -135,7 +135,7 @@ module.exports = { customCss: [ require.resolve('./node_modules/modern-normalize/modern-normalize.css'), require.resolve('./node_modules/@ionic-internal/ionic-ds/dist/tokens/tokens.css'), - require.resolve('./src/styles/custom.scss'), + require.resolve('./src/css/custom.scss'), ], }, }, diff --git a/src/components/global/BestPracticeFigure/index.tsx b/src/components/global/BestPracticeFigure/index.tsx index d66f48e2412..efeafff51a2 100644 --- a/src/components/global/BestPracticeFigure/index.tsx +++ b/src/components/global/BestPracticeFigure/index.tsx @@ -1,49 +1,49 @@ import React, { type ReactNode } from 'react'; -import './best-practice-figure.css'; +import styles from './styles.module.css'; /** - Usage: - - import BestPracticeFigure from '@components/global/BestPracticeFigure'; - - } - doNotImage={...} - /> - - All images must have alt text for screen readers. - - Custom HTML can also be passed to any of the text properties by using curly braces: - - text={<>My text with a link} - - Markdown such as backticks will not be processed when using curly braces. - The tag can be used instead: - - text={<>The button property} - - This component also supports a caution option. Typically you should use - either a "Don't" image or a "Caution" image but not both. - - } - cautionImage={...} - /> - - @prop text - Text that describes the figure as a whole - @prop doText - Text that describes a best practice - @prop doNotText - Text that describes an anti-pattern - @prop cautionText - Text that describes something that could be an anti-pattern based on use case - @prop doImage - Image associated with doText - @prop doNotImage - Image associated with doNotText - @prop cautionImage - Image associated with cautionText + * Usage: + * + * import BestPracticeFigure from '@components/global/BestPracticeFigure'; + * + * } + * doNotImage={...} + * /> + * + * All images must have alt text for screen readers. + * + * Custom HTML can also be passed to any of the text properties by using curly braces: + * + * text={<>My text with a link} + * + * Markdown such as backticks will not be processed when using curly braces. + * The tag can be used instead: + * + * text={<>The button property} + * + * This component also supports a caution option. Typically you should use + * either a "Don't" image or a "Caution" image but not both. + * + * } + * cautionImage={...} + * /> + * + * @prop text - Text that describes the figure as a whole + * @prop doText - Text that describes a best practice + * @prop doNotText - Text that describes an anti-pattern + * @prop cautionText - Text that describes something that could be an anti-pattern based on use case + * @prop doImage - Image associated with doText + * @prop doNotImage - Image associated with doNotText + * @prop cautionImage - Image associated with cautionText */ export default function BestPracticeFigure({ @@ -64,30 +64,30 @@ export default function BestPracticeFigure({ cautionImage?: ReactNode; }) { return ( -
+

{text}

-
-
-
{doImage}
+
+
+
{doImage}
-
Do
+
Do

{doText}

{doNotText && doNotImage && ( -
-
{doNotImage}
+
+
{doNotImage}
-
Don't
+
Don't

{doNotText}

)} {cautionText && cautionImage && ( -
-
{cautionImage}
+
+
{cautionImage}
-
Caution
+
Caution

{cautionText}

diff --git a/src/components/global/BestPracticeFigure/best-practice-figure.css b/src/components/global/BestPracticeFigure/styles.module.css similarity index 61% rename from src/components/global/BestPracticeFigure/best-practice-figure.css rename to src/components/global/BestPracticeFigure/styles.module.css index 140024cbf83..d2a1ff72a2e 100644 --- a/src/components/global/BestPracticeFigure/best-practice-figure.css +++ b/src/components/global/BestPracticeFigure/styles.module.css @@ -1,4 +1,4 @@ -.best-practice__do_dont { +.doDont { display: grid; grid-template-columns: 1fr 1fr; @@ -8,30 +8,30 @@ /* Collapse to 1 column per row on smaller viewports */ @media (max-width: 996px) { - .best-practice__do_dont { + .doDont { grid-template-columns: 1fr; } } -.best-practice__container figcaption { +.container figcaption { text-align: start; } -.best-practice__do p, -.best-practice__dont p, -.best-practice__caution p { +.do p, +.dont p, +.caution p { padding: 8px 16px; } -.best-practice__image-wrapper { +.imageWrapper { border-radius: 8px 8px 0px 0px; overflow: hidden; } -.best-practice__dont-text, -.best-practice__do-text, -.best-practice__caution-text { +.dontText, +.doText, +.cautionText { padding: 12px 16px; font-weight: 600; @@ -39,28 +39,28 @@ border-radius: 0px 0px 8px 8px; } -.best-practice__do .best-practice__image-wrapper { +.do .imageWrapper { border: 1px solid var(--c-blue-10); } -.best-practice__dont .best-practice__image-wrapper { +.dont .imageWrapper { border: 1px solid var(--c-red-10); } -.best-practice__caution .best-practice__image-wrapper { +.caution .imageWrapper { border: 1px solid var(--c-yellow-10); } -.best-practice__dont-text { +.dontText { color: var(--c-red-100); background: var(--c-red-10); } -.best-practice__do-text { +.doText { color: var(--c-blue-100); background: var(--c-blue-10); } -.best-practice__caution-text { +.cautionText { /* --c-yellow-100 does not have enough contrast * placed on top of --c-yellow-10, so we manually * choose a darker text color here. diff --git a/src/components/global/DocDemo/index.js b/src/components/global/DocDemo/index.js index 21984c697bc..6e0ca73496a 100644 --- a/src/components/global/DocDemo/index.js +++ b/src/components/global/DocDemo/index.js @@ -2,7 +2,7 @@ import React, { useEffect, useState, useRef, useCallback } from 'react'; import clsx from 'clsx'; import Link from '@docusaurus/Link'; -import './demo.css'; +import styles from './styles.module.css'; const DocDemo = (props) => { const [ionicMode, setIonicMode] = useState('ios'); @@ -41,11 +41,11 @@ const DocDemo = (props) => { }; const modeToggle = ( -
+
{['ios', 'md'].map((mode) => (