Skip to content
This repository has been archived by the owner on Aug 13, 2023. It is now read-only.

Latest commit

 

History

History

psammead-figure

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

psammead-figure - Known Vulnerabilities Dependency Status peerDependencies Status Storybook GitHub license npm version PRs Welcome

Description

The psammead-figure component is a styled <figure> element. It has the same semantic meaning -- it should be used to surround images, tables or code snippets.

Installation

npm install @bbc/psammead-figure

Props

Argument Type Required Default Example
No props.

Usage

The following example shows psammead-figure wrapping an

import Caption from '@bbc/psammead-caption';
import Copyright from '@bbc/psammead-copyright';
import Figure from '@bbc/psammead-figure';
import Image from '@bbc/psammead-image';
import ImagePlaceholder from '@bbc/psammead-image-placeholder';
import VisuallyHiddenText from '@bbc/psammead-visually-hidden-text';

const Wrapper = ({ alt, captionText, ratio, src, width }) => (
  <Figure>
    <ImagePlaceholder ratio={ratio}>
      <Image alt={alt} src={src} width={width} />
      <Copyright>
        <VisuallyHiddenText>Image copyright, </VisuallyHiddenText>
        {copyrightOwner}
      </Copyright>
    </ImagePlaceholder>
    <Caption>
      <VisuallyHiddenText>Image caption, </VisuallyHiddenText>
      {captionText}
    </Caption>
  </Figure>
);

When to use this component

Use this component when a <figure> element, which represents self-contained content that frequently has a caption, is required. Figures usually wrap an image.

Accessibility notes

The psammead-figure is a <figure> element with associated styles. When you use this component, it has the same semantic meaning as a regular figure element.

Contributing

Psammead is completely open source. We are grateful for any contributions, whether they be new components, bug fixes or general improvements. Please see our primary contributing guide which can be found at the root of the Psammead respository.

We welcome feedback and help on this work. By participating in this project, you agree to abide by the code of conduct. Please take a moment to read it.

License

Psammead is Apache 2.0 licensed.