mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
Port maxHeight module to plugin
This commit is contained in:
parent
3c99be09ca
commit
b5a51e879d
@ -1,3 +1,4 @@
|
||||
import maxHeight from './plugins/maxHeight'
|
||||
import maxWidth from './plugins/maxWidth'
|
||||
import minHeight from './plugins/minHeight'
|
||||
import minWidth from './plugins/minWidth'
|
||||
@ -29,6 +30,7 @@ import zIndex from './plugins/zIndex'
|
||||
|
||||
export default function (config) {
|
||||
return [
|
||||
config.modules.maxHeight === false ? () => {} : maxHeight(),
|
||||
config.modules.maxWidth === false ? () => {} : maxWidth(),
|
||||
config.modules.minHeight === false ? () => {} : minHeight(),
|
||||
config.modules.minWidth === false ? () => {} : minWidth(),
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
import _ from 'lodash'
|
||||
import defineClass from '../util/defineClass'
|
||||
|
||||
function defineMaxHeights(heights) {
|
||||
return _.map(heights, (size, modifer) => {
|
||||
return defineClass(`max-h-${modifer}`, {
|
||||
'max-height': `${size}`,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export default function(config) {
|
||||
return _.flatten([defineMaxHeights(config.maxHeight)])
|
||||
}
|
||||
13
src/plugins/maxHeight.js
Normal file
13
src/plugins/maxHeight.js
Normal file
@ -0,0 +1,13 @@
|
||||
import _ from 'lodash'
|
||||
|
||||
export default function () {
|
||||
return function ({ addUtilities, config, e }) {
|
||||
const utilities = _.fromPairs(_.map(config('maxHeight'), (value, modifier) => {
|
||||
return [`.${e(`max-h-${modifier}`)}`, {
|
||||
'max-height': value,
|
||||
}]
|
||||
}))
|
||||
|
||||
addUtilities(utilities, config('modules.maxHeight'))
|
||||
}
|
||||
}
|
||||
@ -19,7 +19,6 @@ import fontWeights from './generators/fontWeights'
|
||||
import height from './generators/height'
|
||||
import leading from './generators/leading'
|
||||
import margin from './generators/margin'
|
||||
import maxHeight from './generators/maxHeight'
|
||||
|
||||
export default [
|
||||
{ name: 'lists', generator: lists },
|
||||
@ -43,5 +42,4 @@ export default [
|
||||
{ name: 'height', generator: height },
|
||||
{ name: 'leading', generator: leading },
|
||||
{ name: 'margin', generator: margin },
|
||||
{ name: 'maxHeight', generator: maxHeight },
|
||||
]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user