feat: setup resource title & extract necessary helpers

This commit is contained in:
Jean-Philippe Sirois
2019-07-30 08:44:07 -04:00
parent 1be2818a08
commit a893cf4a6a
3 changed files with 34 additions and 19 deletions
+18
View File
@@ -5,6 +5,24 @@ export const BASE_FONT_SIZE = 18
export const BASE_LINE_HEIGHT = 25
export const MODULAR_SCALE = 1.1487
function modularFontSize(power: number) {
return BASE_FONT_SIZE * Math.pow(MODULAR_SCALE, power)
}
export function modularScale(power: number) {
const fontSize = modularFontSize(power)
// attempt to fit line-height a little larger than font-size
const paddedLineHeight = fontSize * 1.1
const lineHeight =
paddedLineHeight - (paddedLineHeight % BASE_LINE_HEIGHT) + BASE_LINE_HEIGHT
return {
fontSize,
lineHeight,
}
}
export const fontFamily = {
header: FONT_MONTSERRAT,
body: FONT_OXYGEN,