Skip to content

Commit

Permalink
fix(core): use own font interface, do not rely on react
Browse files Browse the repository at this point in the history
Instead of using CSSProperties that require to have React as a dependency even for a core package,
write own Font interface.

fixes #811
  • Loading branch information
Julius Osokinas committed Jul 13, 2021
1 parent 4035fe3 commit 7d8b5d1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/core/src/helpers/font/font.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { toCSS } from '@onfido/castor';
import { CSSProperties } from 'react';

/**
* Returns an object that represents a `Font`.
Expand Down Expand Up @@ -39,10 +38,13 @@ export function font(name: FontName): Font {
return { ...styles, toString: () => toCSS(styles) } as Font;
}

export type Font = Pick<
CSSProperties,
`font${'Family' | 'Size' | 'Weight'}` | 'lineHeight' | 'textTransform'
>;
export interface Font {
fontFamily: string;
fontSize: string;
fontWeight: number;
lineHeight: string;
textTransform: string;
}

export type FontName =
| `${FontSize}-bold`
Expand Down

0 comments on commit 7d8b5d1

Please sign in to comment.