@bbc/psammead-assets

中文文档
3.3.0发布于 2022/04/13Apache-2.0零依赖近 30 天下载 9674

A collection of common assets that are likely to be required by many Psammead components or users, such as SVGs or small scripts.

原始使用文档
文档目录14 节
  1. Exports
  2. Installation
  3. Usage
  4. Service SVGs
  5. Usage
  6. Core Icons SVGs
  7. Usage
  8. Media Icons SVGs
  9. Usage
  10. Navigation Icons SVGs
  11. Usage
  12. Contributing
  13. Code of Conduct
  14. License

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

This package provides a collection of common assets that are likely to be required by many Psammead components or users, such as SVGs or small scripts.

Exports

/amp-boilerplate - A helper, allowing projects using Psammead to easily pull in a versioned copy of AMP's required boilerplate scripts. /svgs - SVG icons commonly required by projects using Psammead.

Installation

npm install @bbc/psammead-assets --save

Usage

import { BBC_BLOCKS, news } from '@bbc/psammead-assets/svgs';

import { AMP_SCRIPT } from '@bbc/psammead-assets/amp-boilerplate';

Service SVGs

Service brand SVGs, like news, are objects that contains an svg group, viewbox, ratio and height;

This package currently has brand SVGs for the BBC News World Services as well as for BBC News, BBC Scotland.

PropertyTypeRequiredDefaultExample
groupnodeYesN/A<g fillrule="evenodd"><path d="M84.32" /></g>
viewboxobjectYesN/A{ height: 24, width: 167.95 }
rationumberYesN/A6.9979

The width of your SVG can be calculated using your desired height multiplied by the ratio value provided above.

Usage

const WrappingContainer = () => (
  <svg viewBox={`0 0 ${news.viewbox.width} ${news.viewbox.height}`}>{news.group}</svg>
);

Core Icons SVGs

Core icons is an object containing styled SVG icons from GEL Iconography Core. By default Core icons are sized to work well alongside text from the GEL BodyCopy typography group.

Usage

import { coreIcons } from '@bbc/psammead-assets/svgs';

<p>{coreIcons.info} Did you know, in Switzerland it's illegal to own just one guinea pig?</p>

Media Icons SVGs

Media icons is an object containing styled SVG icons for video, audio, photogallery and guidance. Media icons are sized to work well alongside specific text with typography group GEL Minion. They are used in psammead-media-indicator and psammead-media-player components.

Usage

import { mediaIcons } from '@bbc/psammead-assets/svgs';

<span>
  {mediaIcons.audio}
  {duration && datetime && (<time dateTime={datetime}>{duration}</time>)}
</span>

Navigation Icons SVGs

Navigation icons is an object containing styled SVG icons for hamburger and cross. They are used in psammead-navigation component.

Usage

import { navigationIcons } from '@bbc/psammead-assets/svgs';

<span>
  {navigationIcons.cross}
</span>

Contributing

When adding a new export to this utility package the export tests also need to be updated. When removing an exisiting export from this utility package the export tests need to be updated and the package version requires a major change (EG: 1.2.1 -> 2.0.0) as this would be considered a breaking change due to functionality being removed.

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-assets 共发布 62 个版本,首次发布于 2018/11/29;过去 12 个月发布了 0 个版本。

版本发布日期距今
3.3.0latest2022/04/134 年前
3.2.02022/04/084 年前
3.1.102021/11/304 年前
3.1.92021/05/275 年前
3.1.82021/03/105 年前
3.1.72021/03/025 年前

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

@bbc/psammead-assets 是什么?

A collection of common assets that are likely to be required by many Psammead components or users, such as SVGs or small scripts.

如何安装 @bbc/psammead-assets?

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

@bbc/psammead-assets 支持 TypeScript 吗?

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

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

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

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

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

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

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