-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1434 from NYPL/DR-2525/featuredcontent
DR-2525 FeaturedContent Component
- Loading branch information
Showing
11 changed files
with
1,201 additions
and
1 deletion.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import { ArgTypes, Canvas, Description, Meta, Source } from "@storybook/blocks"; | ||
import { changelogData } from "./featuredContentChangelogData"; | ||
import ComponentChangelogTable from "../../utils/ComponentChangelogTable"; | ||
import * as FeaturedContentStories from "./FeaturedContent.stories"; | ||
import Link from "../Link/Link"; | ||
|
||
<Meta of={FeaturedContentStories} /> | ||
|
||
# Featured Content | ||
|
||
| Component Version | DS Version | | ||
| ----------------- | ---------- | | ||
| Added | Prerelease | | ||
| Latest | Prerelease | | ||
|
||
## Table of Contents | ||
|
||
- {<Link href="#overview" target="_self">Overview</Link>} | ||
- {<Link href="#component-props" target="_self">Component Props</Link>} | ||
- {<Link href="#accessibility" target="_self">Accessibility</Link>} | ||
- {<Link href="#component-width-variations" target="_self">Component Width Variations</Link>} | ||
- {<Link href="#image-position-variations" target="_self">Image Position Variations</Link>} | ||
- {<Link href="#image-width-variations" target="_self">Image Width Variations</Link>} | ||
- {<Link href="#changelog" target="_self">Changelog</Link>} | ||
|
||
## Overview | ||
|
||
The `FeaturedContent` component provides a method to visually emphasize a text block with an image, within a full page layout. | ||
|
||
## Component Props | ||
|
||
<Canvas of={FeaturedContentStories.WithControls} /> | ||
|
||
<ArgTypes of={FeaturedContentStories.WithControls} /> | ||
|
||
## Accessibility | ||
|
||
The `FeaturedContent` component combines a text block and an image. The text block (`textContent`) can be any JSX element, so accessibility for child input elements should follow the accessibility requirements specified for each input component (for example, [Button](https://nypl.github.io/nypl-design-system/reservoir/v1/?path=/docs/components-form-elements-button--docs)). | ||
All images must have an `alt` attribute, even if it's empty. The `alt` prop should be used to concisely describe the image. | ||
If the image is decorative, then the `alt` prop should be an empty string `""`. | ||
|
||
Resources for text accessibility: | ||
|
||
- [Chakra UI Text](https://chakra-ui.com/docs/components/typography/text) | ||
|
||
Resources for image accessibility: | ||
|
||
- [W3C WAI Images Tutorial](https://www.w3.org/WAI/tutorials/images/) | ||
- [WebAIM Accessible Images](https://webaim.org/techniques/images/) | ||
- [Yale Usability & Web Accessibility](https://usability.yale.edu/web-accessibility/articles/images) | ||
|
||
## Component Width Variations | ||
|
||
The width variations of the `FeaturedContent` component can be rendered through the `isFullWidth` prop. | ||
The default is `isFullWidth = false`, and the component will fill only its parent. If `isFullWidth = true`, component will fill the screen's width (max 1280px), breaking out of its parent container. | ||
This full layout is best viewed on a full screen, not as shown below. | ||
|
||
<Canvas of={FeaturedContentStories.LayoutVariations} /> | ||
|
||
## Image Position Variations | ||
|
||
The image position variations of the `FeaturedContent` component can be rendered through the `imageProps.position` prop. The default is `end`, and the image will appear after the text block in a row (on mobile, it will appear below). | ||
The other option is `start`, where the image will appear before the text block in the row on desktop (and above it on mobile). | ||
|
||
<Canvas of={FeaturedContentStories.ImagePositionVariations} /> | ||
|
||
## Image Width Variations | ||
|
||
The image width variations of the `FeaturedContent` component can be rendered through the `imageProps.width` prop. | ||
The options for width are `oneQuarter`, `oneThird`, `oneHalf`, `twoThirds`, and `threeQuarters`. The default width is `oneHalf`. | ||
|
||
<Canvas of={FeaturedContentStories.imageWidthVariations} /> | ||
|
||
## Text Content | ||
|
||
`textContent` is a string or JSX element passed into `FeaturedContent`, so accessibility standards and spacing should be considered independently of the `FeaturedContent` styling. | ||
|
||
The above example with an overline, a heading, a short paragraph of body text, and a CTA button is the recommended usage. While other configurations are possible, keep in mind that the minimum height of the component is 320px and it is best to avoid excessive white space. | ||
|
||
<Canvas of={FeaturedContentStories.textContentVariations} /> | ||
|
||
## Changelog | ||
|
||
<ComponentChangelogTable changelogData={changelogData} /> |
Oops, something went wrong.
2571864
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
nypl-design-system – ./
nypl-design-system-nypl.vercel.app
nypl-design-system-git-development-nypl.vercel.app
nypl-design-system.vercel.app