mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
30 lines
564 B
JavaScript
30 lines
564 B
JavaScript
import _ from 'lodash'
|
|
|
|
export default function buildMediaQuery(screens) {
|
|
if (_.isString(screens)) {
|
|
screens = { min: screens }
|
|
}
|
|
|
|
if (!_.isArray(screens)) {
|
|
screens = [screens]
|
|
}
|
|
|
|
return _(screens).map((screen) => {
|
|
if (_.has(screen, 'raw')) {
|
|
return screen.raw
|
|
}
|
|
|
|
return _(screen).map((value, feature) => {
|
|
feature = _.get(
|
|
{
|
|
min: 'min-width',
|
|
max: 'max-width',
|
|
},
|
|
feature,
|
|
feature
|
|
)
|
|
return `(${feature}: ${value})`
|
|
}).join(' and ')
|
|
}).join(', ')
|
|
}
|