From 0124ae342c641ac2febeb6bd3d9e64820191806d Mon Sep 17 00:00:00 2001 From: basher Date: Fri, 26 Apr 2024 12:01:48 +0100 Subject: [PATCH] mdx improvements --- ui/package.json | 2 +- ui/stories/2. Design System/Colours/Colours.mdx | 4 +++- ui/stories/2. Design System/Icons/Icons.mdx | 6 +++--- ui/stories/3. Layout/Flex/Flex.mdx | 6 +++--- ui/stories/3. Layout/Grid/Grid.mdx | 9 +++------ ui/stories/3. Layout/Wrapper/Wrapper.mdx | 6 +++--- ui/stories/5. Components/Accordion/Accordion.mdx | 5 ++--- ui/stories/5. Components/Cards/Cards.mdx | 2 +- ui/stories/5. Components/Carousel/Carousel.mdx | 4 ++-- ui/stories/5. Components/Images/Images.mdx | 3 +-- .../5. Components/Responsive Media/ResponsiveMedia.mdx | 5 ++--- .../WebUI Ajax Loader/WebUIAjaxLoader.mdx | 4 ++-- .../WebUI Carousel/WebUICarousel.mdx | 6 +++--- .../WebUI Disclosure/WebUIDisclosure.mdx | 6 +++--- .../WebUI Fetch Html/WebUIFetchHtml.mdx | 4 ++-- .../WebUI Form Validate/WebUIFormValidate.mdx | 4 ++-- .../WebUI Image Gallery/WebUIImageGallery.mdx | 4 ++-- .../WebUI Make Clickable/WebUIMakeClickable.mdx | 4 ++-- .../WebUI Modal/WebUIModal.mdx | 4 ++-- .../WebUI Notify/WebUINotify.mdx | 5 ++--- .../WebUI Predictive Search/WebUIPredictiveSearch.mdx | 4 ++-- .../WebUI Range Input/WebUIRangeInput.mdx | 4 ++-- .../WebUI Share/WebUIShare.mdx | 4 ++-- .../WebUI Tabs/WebUITabs.mdx | 3 +-- .../WebUI Toggle/WebUIToggle.mdx | 5 ++--- .../WebUI Video Player/WebUIVideoPlayer.mdx | 4 ++-- 26 files changed, 55 insertions(+), 62 deletions(-) diff --git a/ui/package.json b/ui/package.json index 7d72711..d6d2932 100644 --- a/ui/package.json +++ b/ui/package.json @@ -2,7 +2,7 @@ "name": "web-ui-boilerplate", "description": "UI boilerplate for websites/webapps using vanilla HTML/CSS/JavaScript, powered by Storybook, bundled by Parcel.", "author": "basher", - "version": "3.1.6", + "version": "3.1.7", "license": "ISC", "repository": { "type": "git", diff --git a/ui/stories/2. Design System/Colours/Colours.mdx b/ui/stories/2. Design System/Colours/Colours.mdx index 9cda9db..397cf7c 100644 --- a/ui/stories/2. Design System/Colours/Colours.mdx +++ b/ui/stories/2. Design System/Colours/Colours.mdx @@ -1,4 +1,4 @@ -import { Meta } from '@storybook/blocks'; +import { Meta, Canvas } from '@storybook/blocks'; import * as Colours from './Colours.stories'; @@ -7,6 +7,8 @@ import * as Colours from './Colours.stories'; The default Sass colour variables get automatically exported to a JSON file when Parcel server is started with `npm start`. + + ## Dark mode Colours in the swatch will be updated automatically if the operating system preference for `dark mode` is selected. - This triggers the CSS `prefers-color-scheme: dark` media query. diff --git a/ui/stories/2. Design System/Icons/Icons.mdx b/ui/stories/2. Design System/Icons/Icons.mdx index 08e5d15..d47044d 100644 --- a/ui/stories/2. Design System/Icons/Icons.mdx +++ b/ui/stories/2. Design System/Icons/Icons.mdx @@ -5,6 +5,9 @@ import * as Icons from './Icons.stories'; # Icons + + + ## Accessibility considerations - Accessible HTML markup for icons is based on these 3 articles: @@ -23,6 +26,3 @@ import * as Icons from './Icons.stories'; - The default icon size is `1em` so that it inherits the font size of its parent container. - Selecting any of the available size variants will set a specific icon size in `rem` units. - - - diff --git a/ui/stories/3. Layout/Flex/Flex.mdx b/ui/stories/3. Layout/Flex/Flex.mdx index 4aad955..0ee78c0 100644 --- a/ui/stories/3. Layout/Flex/Flex.mdx +++ b/ui/stories/3. Layout/Flex/Flex.mdx @@ -7,6 +7,9 @@ import * as Flex from './Flex.stories'; - Flexbox should **not** be used for a grid system. - Use something like [grid layout](/story/layout-grid--grid) or [asymmetric 2-col grid](/story/layout-grid--grid-asymmetric) for that. + + + ## When to use Flexbox or Grid? - Please see [useful layout tips](/docs/layout-useful-layout-tips--docs). @@ -20,6 +23,3 @@ Change flex direction | `flex--column`, `flex--row-reverse`, `flex--column-rever Align items | `flex--ai-center`, `flex--ai-start`, `flex--ai-end` Justify content | `flex--jc-center`, `flex--jc-end`, `flex--jc-between` Make ALL flex items grow to fill up available space | `flex--grow-all` - - - diff --git a/ui/stories/3. Layout/Grid/Grid.mdx b/ui/stories/3. Layout/Grid/Grid.mdx index 684c8ab..967ab28 100644 --- a/ui/stories/3. Layout/Grid/Grid.mdx +++ b/ui/stories/3. Layout/Grid/Grid.mdx @@ -17,6 +17,9 @@ grid-template-columns: repeat( ); ``` + + + ## When to use Grid or Flexbox? - Please see [useful layout tips](/docs/layout-useful-layout-tips--docs). @@ -60,12 +63,6 @@ widget-grid.grid { - Add the appropriate classname in the HTML - `grid--centered`. - See [cards in a grid](/story/components-cards--card-grid) for a real example. -## Grid layout using `
` elements -- Use generic ` - - ## Grid layout using `
    ` elements diff --git a/ui/stories/3. Layout/Wrapper/Wrapper.mdx b/ui/stories/3. Layout/Wrapper/Wrapper.mdx index 77b576e..63fb30e 100644 --- a/ui/stories/3. Layout/Wrapper/Wrapper.mdx +++ b/ui/stories/3. Layout/Wrapper/Wrapper.mdx @@ -9,6 +9,9 @@ import * as Wrapper from './Wrapper.stories'; - For more complex layouts (e.g. multi-column), use one of the [grid layouts](/docs/layout-grid--docs). - Ideally, there should be **NO visual styles** applied to wrappers (e.g. background colour). + + + ## Override margin - Use [stack layout](/story/layout-stack--stack) to apply vertical `gutters` between sibling wrappers. @@ -17,6 +20,3 @@ import * as Wrapper from './Wrapper.stories'; ## Applying visual styles to wrapper - Add a [skin component](/story/components-skin--skin-wrapper) classname. - - - diff --git a/ui/stories/5. Components/Accordion/Accordion.mdx b/ui/stories/5. Components/Accordion/Accordion.mdx index adb9c6d..e8cb14b 100644 --- a/ui/stories/5. Components/Accordion/Accordion.mdx +++ b/ui/stories/5. Components/Accordion/Accordion.mdx @@ -6,14 +6,13 @@ import * as Accordion from './Accordion.stories'; # Accordion - Uses the native HTML `
    `|`` elements. + + ## Accessibility considerations - There are several articles cautioning against using `
    `|`` for accordions. For example: - [Scott O'Hara](https://www.scottohara.me//blog/2022/09/12/details-summary.html). - [Dave Rupert](https://daverupert.com/2019/12/why-details-is-not-an-accordion/). - An alternative approach is to use the [disclosure](/story/components-disclosure-or-show-hide--disclosure) component. - - ## With custom icon - diff --git a/ui/stories/5. Components/Cards/Cards.mdx b/ui/stories/5. Components/Cards/Cards.mdx index 387d976..bd1c758 100644 --- a/ui/stories/5. Components/Cards/Cards.mdx +++ b/ui/stories/5. Components/Cards/Cards.mdx @@ -10,7 +10,7 @@ import * as CardsNoArgs from './CardsNoArgs.stories'; - By default, cards have no visual treatment such as background colour, border, shadow, etc. Apply visual styles using the [skin component](/story/components-skin--skin). - Also see [Inclusive Components cards](https://inclusive-components.design/cards/). -## Card +## Default card - The default card component is marked up as an `
    `, and should therefore contain a heading with the appropriate level. - Uses `` with a single fixed size image, whose orientation can be `top`, `bottom`, `left` or `right`. diff --git a/ui/stories/5. Components/Carousel/Carousel.mdx b/ui/stories/5. Components/Carousel/Carousel.mdx index a193cda..36f3176 100644 --- a/ui/stories/5. Components/Carousel/Carousel.mdx +++ b/ui/stories/5. Components/Carousel/Carousel.mdx @@ -8,13 +8,13 @@ import * as Carousel from './Carousel.stories'; - It leverages [CSS scroll snap](https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-type) to improve keyboard-only behaviour. - Slide widths are defined by the CSS `--slide-min-width` custom property. This can be overridden for specific carousel implementations. For example, see the [card carousel](/story/components-cards--card-carousel). + + ## Accessibility considerations - Based on [Inclusive Components carousel](https://inclusive-components.design/a-content-slider/) and [ARIA APG carousel pattern](https://www.w3.org/WAI/ARIA/apg/patterns/carousel/). - The carousel has `tabindex="0"` so it can receive keyboard `focus`, and be operated via the `LEFT|RIGHT` arrow keys. - CSS `scroll-snap` ensures the carousel stops at a complete slide. - - ## CSS-only fullwidth slides (e.g. banner carousel) diff --git a/ui/stories/5. Components/Images/Images.mdx b/ui/stories/5. Components/Images/Images.mdx index 029bcd2..e11d958 100644 --- a/ui/stories/5. Components/Images/Images.mdx +++ b/ui/stories/5. Components/Images/Images.mdx @@ -4,6 +4,7 @@ import * as Images from './Images.stories'; # Images + ## Responsive and performance considerations - Responsive images use the HTML `` element with multiple image `sources`. @@ -11,8 +12,6 @@ import * as Images from './Images.stories'; - Images are [lazy loaded](https://developer.mozilla.org/en-US/docs/Web/Performance/Lazy_loading), but be aware of [not lazy loading images above the fold](https://web.dev/lazy-loading-best-practices/). - Images have [explicit height & width](https://www.smashingmagazine.com/2020/03/setting-height-width-images-important-again/) declared in the HTML. - - ## Fixed size images - If just 1 image size is needed, still use the `` element. - This allows **next-gen** images to be served - e.g. `type="image/webp"`. diff --git a/ui/stories/5. Components/Responsive Media/ResponsiveMedia.mdx b/ui/stories/5. Components/Responsive Media/ResponsiveMedia.mdx index ddbdaae..d856333 100644 --- a/ui/stories/5. Components/Responsive Media/ResponsiveMedia.mdx +++ b/ui/stories/5. Components/Responsive Media/ResponsiveMedia.mdx @@ -11,6 +11,8 @@ import * as ResponsiveMedia from './ResponsiveMedia.stories'; style="--media-aspect-ratio: 21/9;" ``` + + ## Accessibility considerations - `