@bbc/psammead-copyright

中文文档
3.0.31发布于 2022/03/30Apache-2.0ESM + CJS近 30 天下载 6475

React styled component for overlaid copyright or source attribution.

原始使用文档
文档目录10 节
  1. Description
  2. Installation
  3. Props
  4. Usage
  5. When to use this component
  6. When not to use this component
  7. Accessibility notes
  8. Contributing
  9. Code of Conduct
  10. License

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

ArgumentTypeRequiredDefaultExample
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.

版本与发布记录

@bbc/psammead-copyright 共发布 100 个版本,首次发布于 2018/12/12;过去 12 个月发布了 0 个版本。

版本发布日期距今
3.0.31latest2022/03/304 年前
3.0.302022/03/294 年前
3.0.292022/01/064 年前
3.0.282021/10/065 年前
3.0.272021/09/305 年前
3.0.262021/09/225 年前

其他发布通道:alpha → 2.0.0-alpha.0。

关于 @bbc/psammead-copyright 的常见问题

@bbc/psammead-copyright 是什么?

React styled component for overlaid copyright or source attribution.

如何安装 @bbc/psammead-copyright?

在项目目录运行 npm install @bbc/psammead-copyright,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@emotion/styled(^11.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@bbc/psammead-copyright 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/bbc__psammead-copyright 是否存在。

@bbc/psammead-copyright 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@bbc/psammead-copyright 可以商用吗?

@bbc/psammead-copyright 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@bbc/psammead-copyright 的下载量有多少?

根据 npm 官方下载统计,@bbc/psammead-copyright 在 2026/10/08 – 2026/11/06 这 30 天内被下载 6,475 次,日均约 216 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@bbc/psammead-copyright 还在维护吗?

最新版本 3.0.31 发布于 2022/03/30(4 年前);至今共发布 100 个版本,其中过去 12 个月发布了 0 个;首次发布于 2018/12/12。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。