Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Commit

Permalink
Add typographyToCss overrides param
Browse files Browse the repository at this point in the history
  • Loading branch information
arnemolland committed Aug 6, 2021
1 parent 3288c5d commit d219988
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/lib/theme/typography.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
export type FontFamily = 'Montserrat' | 'Mulish'

export const typographyToCss = (style: TypographyStyle) => `
font-family: ${style.fontFamily};
font-size: ${style.fontSize};
font-weight: ${style.fontWeight};
line-height: ${style.lineHeight};
export const typographyToCss = (style: TypographyStyle, overrides?: Partial<TypographyStyle>) => `
font-family: ${overrides && overrides.fontFamily ? overrides.fontFamily : style.fontFamily};
font-size: ${overrides && overrides.fontSize ? overrides.fontSize : style.fontSize};
font-weight: ${overrides && overrides.fontWeight ? overrides.fontWeight : style.fontWeight};
line-height: ${overrides && overrides.lineHeight ? overrides.lineHeight : style.lineHeight};
margin-block: 0;
`

export type TypographyStyle = {
Expand Down

0 comments on commit d219988

Please sign in to comment.