Skip to content

Commit

Permalink
rewrote template to typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Marszalek committed Sep 22, 2020
1 parent 3b2b8f9 commit a95da36
Showing 1 changed file with 36 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,39 @@
// @ts-nocheck
import { css } from 'styled-components'
import type { FlattenSimpleInterpolation } from 'styled-components'

export const typographyTemplate = (typography, link) => {
type StyledCSS = FlattenSimpleInterpolation

type Typography = {
color: string
fontFamily: string
fontSize: string
fontWeight: number
letterSpacing: string
lineHeight: string
textAlign?: string
fontStyle?: string
textTransform?: string
textDecoration?: string
fontFeature?: string
}

type Border = {
radius: string
color: string
width: string
}

type Spacing = {
left: string
right: string
top: string
bottom: string
}

export const typographyTemplate = (
typography: Typography,
link?: boolean,
): string => {
if (!typography) {
return ''
}
Expand Down Expand Up @@ -39,14 +71,14 @@ export const typographyTemplate = (typography, link) => {
return base
}

export const spacingsTemplate = (spacings) => css`
export const spacingsTemplate = (spacings: Spacing): StyledCSS => css`
padding-left: ${spacings.left};
padding-right: ${spacings.right};
padding-top: ${spacings.top};
padding-bottom: ${spacings.bottom};
`

export const bordersTemplate = (border) => css`
export const bordersTemplate = (border: Border): StyledCSS => css`
border-radius: ${border.radius};
border-color: ${border.color};
border-width: ${border.width};
Expand Down

0 comments on commit a95da36

Please sign in to comment.