@bbc/psammead-copyright

3.0.31 • Public • Published

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

Description

Displays a source attribution in block capitals in the bottom-right of the parent element. This implementation is primarily intended for use alongside images.

Installation

npm install @bbc/psammead-copyright

Props

Argument Type Required Default Example
No props.

Usage

Commonly used alongside psammead-figure, psammead-image and psammead-image-placeholder. Can also pass in psammead-visually-hidden-text in order to announce the component.

const WrapperComponent = ({ alt, ratio, src, width }) => (
  <Figure>
    <ImagePlaceholder ratio={ratio}>
      <Image alt={alt} src={src} width={width} />
      <Copyright>
        <VisuallyHiddenText>Image source, </VisuallyHiddenText>
        Getty Images
      </Copyright>
    </ImagePlaceholder>
  </Figure>
);

When to use this component

This component is intended to be used alongside images or diagrams contained within a Figure component.

When not to use this component

This component should not be used arbitrarily to represent source attribution across the page. As above, it is not intended to be used outside the Figure component. The accessibility text would be incorrect and potentially confusing.

Do not use this component if you know the source attribution is already covered by another copyright disclosure on the page.

Accessibility notes

The default styling of this component is intended to comply with WCAG colour contrast standards.

The VisuallyHiddenText component can be used as a child of Copyright to add additional context to screen reader users. An example of this can be found in our storybook

This component uses aria role text, to stop 'text splitting' that is observed when using VoiceOver on iPhone and therefore improve the screen reader UX. Without this, the image source element is 2 swipes on VoiceOver (left to right), one for 'Image source' and one for the actual source such as 'Getty images'.

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.

Code of Conduct

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.

Package Sidebar

Install

npm i @bbc/psammead-copyright

Weekly Downloads

134

Version

3.0.31

License

Apache-2.0

Unpacked Size

24.7 kB

Total Files

9

Last publish

Collaborators

  • eagerterrier_bbc
  • bbc-online