Skip to content

Commit

Permalink
Remove deprecated typography API (#1639)
Browse files Browse the repository at this point in the history
  • Loading branch information
sndrs authored Aug 12, 2024
2 parents 447e6b6 + 72ad2e4 commit 70dd3bc
Show file tree
Hide file tree
Showing 17 changed files with 65 additions and 2,133 deletions.
53 changes: 53 additions & 0 deletions .changeset/fluffy-peaches-punch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
'@guardian/source': major
---

Removes deprecated typography API.

In `@guardian/[email protected]` (2024-04-07), we added new [web typography presets](https://guardian.github.io/storybooks/?path=/story/source_foundations-typography--presets) to standardise on the typographic language used by Design, and deprecated the old typography API.

This release removes that old API, in order to simplify the ongoing maintenance of the library.

The following exports have been removed:

- `titlepiece`
- `headline`
- `body`
- `textSans`
- `titlepieceSizes`
- `headlineSizes`
- `bodySizes`
- `textSansSizes`
- `remTitlepieceSizes`
- `remHeadlineSizes`
- `remBodySizes`
- `remTextSansSizes`
- `fonts`
- `fontWeights`
- `lineHeights`
- `bodyObjectStyles`
- `headlineObjectStyles`
- `textSansObjectStyles`
- `titlepieceObjectStyles`

along with the following `type` exports:

- `ScaleUnit`
- `Category`
- `LineHeight`
- `FontWeight`
- `FontStyle`
- `FontWeightDefinition`
- `Option`
- `TypographySizes`
- `TypographyStyles`
- `TitlepieceSizes`
- `HeadlineSizes`
- `BodySizes`
- `TextSansSizes`
- `Fs`
- `FontScaleFunction`
- `FontScaleFunctionStr`
- `FontScaleArgs`

_If you cannot map existing uses of the old API to the new presets, please check which preset you should use with a designer._
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { css } from '@emotion/react';
import type { SerializedStyles } from '@emotion/react';
import {
focusHalo,
fontWeights,
height,
remHeight,
remSpace,
Expand All @@ -23,19 +22,19 @@ export const fileName = (
const defaultUpload = css`
padding: ${remSpace[3]};
border-radius: ${height.ctaMedium}px;
font-weight: ${fontWeights.bold};
font-weight: 700;
`;
const smallUpload = css`
padding: ${remSpace[3]};
border-radius: ${height.ctaSmall}px;
font-weight: ${fontWeights.bold};
font-weight: 700;
`;

const xsmallUpload = css`
padding: 0 ${space[3]}px;
padding: ${remSpace[3]};
border-radius: ${height.ctaXsmall}px;
font-weight: ${fontWeights.bold};
font-weight: 700;
`;

export const warningText = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import {
neutral,
space,
success,
textSans,
textSans15,
textSans17,
textSansBold15,
textSansBold17,
} from '@guardian/source/foundations';
import type {
LabelPosition,
Expand Down Expand Up @@ -140,7 +143,10 @@ export const labelStyles = (
fontWeight: ToggleSwitchFontWeight,
format?: ArticleFormat,
): SerializedStyles => css`
${textSans[fontSize]({ fontWeight })};
${fontSize === 'small' &&
(fontWeight === 'regular' ? textSans15 : textSansBold15)};
${fontSize === 'medium' &&
(fontWeight === 'regular' ? textSans17 : textSansBold17)};
color: ${format ? neutral[100] : neutral[7]};
display: inline-flex;
justify-content: space-between;
Expand Down

This file was deleted.

Loading

0 comments on commit 70dd3bc

Please sign in to comment.