Add support for providing a default line-height for each font-size

This commit is contained in:
Adam Wathan 2020-04-05 14:07:30 -04:00
parent 9c82fecae9
commit aa4fd1ae99
5 changed files with 439 additions and 402 deletions

View file

@ -126,6 +126,7 @@ export default function({ corePlugins: corePluginConfig }) {
fontFamily,
fontWeight,
height,
fontSize,
lineHeight,
listStylePosition,
listStyleType,
@ -152,7 +153,6 @@ export default function({ corePlugins: corePluginConfig }) {
tableLayout,
textAlign,
textColor,
fontSize,
fontStyle,
textTransform,
textDecoration,

View file

@ -4,10 +4,17 @@ export default function() {
return function({ addUtilities, e, theme, variants }) {
const utilities = _.fromPairs(
_.map(theme('fontSize'), (value, modifier) => {
const [fontSize, lineHeight] = Array.isArray(value) ? value : [value]
return [
`.${e(`text-${modifier}`)}`,
{
'font-size': value,
'font-size': fontSize,
...(lineHeight === undefined
? {}
: {
'line-height': lineHeight,
}),
},
]
})