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

Package detail

@bbc/gel-foundations

bbc2.2kApache-2.07.0.0

A range of string constants for use in CSS, intended to help implement BBC GEL-compliant webpages and components.

bbc, utilities, gel, breakpoints, grid, spacing, typography

readme

gel-foundations - Known Vulnerabilities Dependency Status peerDependencies Status GitHub license npm version PRs Welcome

This package provides a range of string constants for use in CSS, intended to help implement BBC GEL-compliant webpages and components.

Exports

/breakpoints - GEL breakpoints, as well as typography breakpoints. These use the GEL grid sizes which can be found in the GEL Grid guidelines. /spacings - GEL spacings and GEL Grid margins and gutters. These use the GEL grid spacing sizes which can be found in the GEL Grid guidelines. /typography - GEL type sizes and font stacks. These are based on the GEL Typography definitions which can be found in the GEL guidelines. More details on how the type sizes were implemented for this package are available here.

Installation

npm install @bbc/gel-foundations --save

Usage

import { GEL_GROUP_3_SCREEN_WIDTH_MIN } from '@bbc/gel-foundations/breakpoints';

import { GEL_GUTTER_ABOVE_600PX } from '@bbc/gel-foundations/spacings';

import { getLongPrimer } from '@bbc/gel-foundations/typography';

These values can then be used directly within CSS declarations in code:

import { css } from 'styled-components';

const SomeStyledComponent = css`
  font-family: ${GEL_FF_REITH_SANS};
  ${getLongPrimer(script)};

  @media (min-width: ${GEL_GROUP_3_SCREEN_WIDTH_MIN}) {
    grid-gap: ${GEL_GUTTER_ABOVE_600PX};
  }
`;

To allow the typography to be fully accessible and responsive, please note that you should apply a default font-size to the document root (e.g. html { font-size: 100% }).

Our typography uses rem for font-size and line-height. The rem unit represents a size relative to the document root, so we use that for font-size, line-height and spacing for a consistent look-and-feel across the document. You can read our detailed analysis of "REMs vs EMs for spacing" for more information.

Script support

The utility typography function (e.g. getLongPrimer('arabic')) receives a script argument which is an object with the different script GEL Types Sizes and returns the font-sizes and line-heights for the specific GEL Type (e.g. Long Premier).

You can import the script doing import { arabic } from '@bbc/gel-foundations/scripts. By default you should import the latin script as found on the GEL typography guidelines.

In addition to Latin script defaults, Psammead supports typography for a number of other scripts. We have grouped the scripts that share similiar features as follows:

Group Name Services Rationale
latin-and-cyrillic News, Hausa, Gahuza, Somali, Swahili, Igbo, Pidgin, Afaan Oromo, Yoruba, Azeri, Indonesia, Uzbek, Serbian, Russian, Ukrainian, Kyrgyz, Uzbek The typography values for Latin and Cyrillic characters are identical
latin-with-diacritics Vietnamese, Mundo, Afrique, Brasil, Turkish The diacritics make these values differ from Latin
arabic Arabic, Pashto, Persian, Urdu Group as they use the Arabic alphabet
no-ascenders-or-descenders Korean, Japanese, Zhongwen, Ukchina, Tigrinya, Amharic Group all alphabets without ascenders or descenders. This could be implemented as chinese, korean, ethiopic
devanagari-and-gurmukhi Hindi, Nepali, Gujarati, Punjabi, Marathi, Telugu The typography values for Devanagari and Gurmukhi characters are identical
thai Thai Bespoke to the Thai characters
bengali Bengali Bespoke to the Bengal characters
burmese Burmese Bespoke to the Burmese characters
sinhalese Sinhala Bespoke to the Sinhalese characters
tamil Tamil Bespoke to the Tamil characters

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 as functionality is 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

Gel Foundations Changelog

Version Description
7.0.0 PR#4568 Removes scripts for old Sinhala, Burmese and Tamil fonts
6.3.0 PR#4548 Adds new sinhala script for new font
6.2.0 PR#4547 Added Noto Serif Bengali font sizes and line heights
6.1.3 PR#4368 use Yarn Workspaces
6.1.2 PR#4335 switch to yarn for package management
6.1.1 PR#4303 Trigger rebuild following babel config update for emotion 11
6.1.0 PR#4244 Add GEL_SPACING_HLF_TRPL.
6.0.0 PR#4008 Use BBC Reith Qalam font sizes and line-heights, and remove arabicPashto script in favour or arabic.
5.0.1 PR#3852 Revert breaking changes prior to Emotion migration.
5.0.0 PR#3805 BBC Reith Qalam v1.100. Removal of arabicPashto script in favour of arabic
4.3.0 PR#3782 Reduce Thai font size
4.2.0 PR#3616 Update Bengali inline link styling
4.1.0 PR#3602 Update Thai Canon typography values
4.0.1 PR#3127 Restructured breakpoints.js to pair the consts which use one another.
4.0.0 PR#3128 Update GEL_GROUP_4_SCREEN_WIDTH_MAX value
3.4.3 PR#2947 Added additional rem sizing for 40px - 58px spacing according to new MAP and OD Radio designs.
3.4.2 PR#2858 Update line heights for Tamil and Devanagari & Gurmukhi scripts (Long Primer and Body Copy types).
3.4.1 PR#2462 Update line heights for Latin with Diacritics.
3.4.0 PR#2169 Add generic script exports - cyrillicAndLatin, devanagariAndGurmukhi & noAscendersOrDescenders
3.3.3 PR#1847 Fixed Telugu typos
3.3.2 PR#1806 Change strings to booleans
3.3.1 PR#1803 Patches broken links on badges in documentation
3.3.0 PR#1794 Add david dependency badges
3.2.2 PR#1758 Update Thai script type sizes for Minion and Brevier.
3.2.1 PR#1682 Move all dev dependencies to top level package.json
3.2.0 PR#1530 Add additional GEL Type sizes for large contexts (Atlas, Elephant, Imperial, Royal, Foolscap)
3.1.0 PR#1212 Export ESM modules via existing API
3.0.3 PR#1155 Use `psammead-test-helpers@1.0.2`
3.0.2 PR#783 Update to latest psammead-test-helpers. Update snapshots.
3.0.1 PR#701 Update README rem doc link
3.0.0 PR#586 Update GEL Types values
2.0.0 PR#517 Remove unused GEL Types
1.2.0 PR#431 Add custom scripts propTypes
1.1.0 PR#424 Add Snyk badge to readme
1.0.0 PR#353 Add support for different scripts typographies
0.3.0 PR#360 Move to using rems for breakpoints
0.2.5 PR#349 Add GEL Group A breakpoint
0.2.4 PR#323 Update readme storybook badge
0.2.3 PR#264 Resolving package-lock issues.
0.2.2 PR#304 Add font family definitions, which include GEL-defined font fallbacks.
0.2.1 PR#303 Bump to ensure correct build is published
0.2.0 PR#290 Move typography font-sizes to use rem instead of em
0.1.4 PR#224 Add tests for the exported values, coverage 100% :tada:
0.1.1 PR#212 Update package description and README.
0.1.0 PR#221 Create initial package, pulled in from gel-constants and gel-foundations-styled-components packages.