Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@bbc/psammead-assets

bbc5.1kApache-2.03.3.0

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

bbc, utilities, assets, svg, amp

readme

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.

Property Type Required Default Example
group node Yes N/A <g fillrule="evenodd"><path d="M84.32" /></g>
viewbox object Yes N/A { height: 24, width: 167.95 }
ratio number Yes N/A 6.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 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.

changelog

Psammead Assets Changelog

Version Description
3.3.0 PR# Add AMP_SCRIPT_JS script
3.2.0 PR#4634 Reduces dark mode BBC block size
3.1.10 PR#4601 SVG size adjustments
3.1.9 PR#4486 upgrade minor/patch dependencies
3.1.8 PR#4420 bumps 3rd-party dependencies
3.1.7 PR#4368 use Yarn Workspaces
3.1.6 PR#4335 switch to yarn for package management
3.1.5 PR#4303 Trigger rebuild following babel config update for emotion 11
3.1.4 PR#4271 change react peer dep to >=16.9.0
3.1.3 PR#4193 Upgrade Emotion to v11
3.1.2 PR#4160 Add SVGs for Sport and Newsround
3.1.1 PR#3939 Reduce ChromaticQA tests. Use chromatic instead of storybook-chromatic, as it has been deprecated
3.1.0 PR#4009 Add new Podcast and Series Stack media icons
3.0.1 PR#3923 Migrate to emotion - fix overlooked styled component reference.
3.0.0 PR#3875 Migrate to Emotion.
2.14.2 PR#3728 Tweaks following Storybook v5.3.19 to v6.0.22 update
2.14.1 PR#3610 Add BBC_BLOCKS_DARK_MODE base64
2.14.0 PR#3374 Add AMP_AD script
2.13.0 PR#3020 Add SVG for Learning English brand logo
2.12.1 PR#2990 Use GEL_SPACING_DBL constant in PhotoMediaIcon and stories container
2.12.0 PR#2935 Add a Clock icon to core icons
2.11.0 PR#2826 Add amp ads js script boilerplate
2.10.3 PR#2694 Add properties to hide Navigation Icons from screen readers
2.10.2 PR#2686 Add SVG for Archive brand logo
2.10.1 PR#2655 Update Navigation Icons to scale with browser font size
2.10.0 PR#2631 Add AMP_BIND, AMP_LIST, AMP_MUSTACHE scripts to amp-boilerplate exports
2.9.0 PR#2641 Add Core icons group with Alert and Info icons
2.8.0 PR#2581 Add hamburger and cross icons for Navigation
2.7.0 PR#2531 Add Guidance icon
2.6.0 PR#2433 Add AMP js script boilerplate to psammead-assets.
2.5.0 PR#2309 Add SVGs for Weather, Cymru Fyw and Naidheachdan
2.4.1 PR#2189 Add storybook stories for media icons in psammead-assets
2.4.0 PR#2192 Add SVG for BBC Scotland
2.3.0 PR#2115 Added media icons SVGs
2.2.4 PR#1942 Talos - Bump React to 16.9.0
2.2.3 PR#1847 Fixed Telugu typos
2.2.2 PR#1806 Change strings to booleans
2.2.1 PR#1803 Patches broken links on badges in documentation
2.2.0 PR#1794 Add david dependency badges
2.1.0 PR#1759 Add Uzbek SVG & update names for Telugu & Ukrainian.
2.0.1 PR#1682 Move all dev dependencies to top level package.json
2.0.0 PR#1646 Add SVGs for these services japanese, mundo, punjabi. Update SVG name from turkish to turkce. Update outline styles of SVG to be white.
1.2.0 PR#1523 Add SVGs for these services: afaanoromoo, afrique, amharic, arabic, azeri, bengali, burmese, gahuza, gujarati, hausa, hindi, igbo, indonesia, korean, kyrgyz, marathi, nepali, news, pashto, persian, pidgin, russian, serbian, sinhala, somali, swahili, tamil, telugu, thai, tigrinya, turkish, urdu, ukchina, ukranian, vietnamese, zhongwen. Update these existing SVGs: igbo, news, persian, pidgin, thai, yoruba.
1.1.1 PR#1360 Bump because NPM didnt publish properly for some reason
1.1.0 PR#1214 Export ESM modules via existing API
1.0.6 PR#1179 use `psammead-test-helpers@1.0.2`
1.0.5 PR#1082 Bump lodash security vulnerability
1.0.4 PR#783 Update to latest psammead-test-helpers. Update snapshots.
1.0.3 PR#787 Fix brand stories in Firefox high contrast mode
1.0.2 PR#713 Update styled-components to 4.3.2
1.0.1 PR#704 Remove fill from SVGs
1.0.0 PR#679 Bump version number
0.1.9 PR#490 Update SVGs to consistent export, minify and add persian
0.1.8 PR#444 Add service SVG's
0.1.7 PR#424 Add Snyk badge to readme
0.1.6 PR#323 Update readme storybook badge
0.1.5 PR#264 Resolving package-lock issues.
0.1.4 PR#224 Add tests for the exported values, coverage 100% :tada:
0.1.3 PR#212 Update package description and README.
0.1.2 PR#173 Update PRs welcome link
0.1.1 PR#74 Move file contents into a src directory and babel transpile prepublish.
0.1.0 PR#49 Create initial package, pulled in from simorgh.