Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

Commit

Permalink
fix: update font sizes (#625)
Browse files Browse the repository at this point in the history
* fix: update font sizes

* fix: remove unnecessary function calls
  • Loading branch information
mjmonline committed Jun 19, 2019
1 parent 8d201fb commit ff562b6
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions src/styles/typography.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,42 @@ const WEIGHTS = {
extrabold: 800,
};

const FONT_FAMILY = '"Nordnet Sans Mono", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';

const commonFontStyles = {
fontFamily: FONT_FAMILY,
letterSpacing: 'normal'
}

export default function createTypography() {
const ifSmallDevice = (smallFontSize, largeFontSize) => ({
fontFamily:
'"Nordnet Sans Mono", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
...commonFontStyles,
fontSize: smallFontSize,
letterSpacing: 'normal',
[`@media only screen and (min-width: ${SMALL_DEVICE}px)`]: {
fontSize: largeFontSize,
},
});
const primary = ({ weight = 'regular' } = {}) => ({
...ifSmallDevice(14, 16),
...commonFontStyles,
fontSize: 16,
fontWeight: WEIGHTS[weight] || WEIGHTS.regular,
});
const coerceExtraboldToBold = weight => (weight === 'extrabold' ? WEIGHTS.bold : WEIGHTS[weight]);
const secondary = ({ weight = 'regular' } = {}) => ({
...ifSmallDevice(12, 14),
...commonFontStyles,
fontSize: 14,
fontWeight: coerceExtraboldToBold(weight) || WEIGHTS.regular,
});
const tertiary = ({ weight = 'regular' } = {}) => ({
...ifSmallDevice(10, 12),
...commonFontStyles,
fontSize: 12,
fontWeight: coerceExtraboldToBold(weight) || WEIGHTS.regular,
});

const caption = ({ weight = 'regular', uppercase = false } = {}) => ({
// @todo discuss lower value with designers
...ifSmallDevice(10, 10),
...commonFontStyles,
fontSize: 10,
fontWeight: coerceExtraboldToBold(weight) || WEIGHTS.regular,
...(uppercase ? { textTransform: 'uppercase' } : {}),
});
Expand All @@ -44,11 +53,11 @@ export default function createTypography() {

const defaultTitleWeight = 'extrabold';
const title1 = ({ weight = defaultTitleWeight } = {}) => ({
...ifSmallDevice(30, 32),
...ifSmallDevice(24, 28),
fontWeight: WEIGHTS[weight] || WEIGHTS[defaultTitleWeight],
});
const title2 = ({ weight = defaultTitleWeight } = {}) => ({
...ifSmallDevice(22, 24),
...ifSmallDevice(20, 24),
fontWeight: WEIGHTS[weight] || WEIGHTS[defaultTitleWeight],
});
const title3 = ({ weight = defaultTitleWeight } = {}) => ({
Expand Down

1 comment on commit ff562b6

@vercel
Copy link

@vercel vercel bot commented on ff562b6 Jun 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.