Skip to content

More API tightening

Compare
Choose a tag to compare
@KyleAMathews KyleAMathews released this 22 Sep 18:37
· 192 commits to master since this release

The helper function awkwardly known as adjustFontSizeToMS is now simply scale which nicely parallels the other commonly used Typography.js helper function rhythm.

scale is used to scale font sizes. When called it returns an object with calculated values for fontSize and lineHeight

e.g.

scale(1) // => { fontSize: '1.51572rem', lineHeight: '2.25rem' }

This makes it easy to adjust the size of elements when using inline styles or css-in-js.
E.g. <div style={{...scale(1)}}</div>

To calibrate your understanding of scale values. A scale value of 0 is the size of the body font. A value of 1 is the (default) size of h1s.