From d2199885359489972b6ef2df430d650d3287a489 Mon Sep 17 00:00:00 2001 From: Arne Molland Date: Fri, 6 Aug 2021 14:40:00 +0200 Subject: [PATCH] Add typographyToCss overrides param --- src/lib/theme/typography.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/lib/theme/typography.ts b/src/lib/theme/typography.ts index 575016a5..b8097811 100644 --- a/src/lib/theme/typography.ts +++ b/src/lib/theme/typography.ts @@ -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) => ` + 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 = {