mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2026-01-18 16:17:36 +00:00
34 lines
646 B
JavaScript
34 lines
646 B
JavaScript
import _ from 'lodash'
|
|
|
|
export default function buildMediaQuery(screens) {
|
|
if (_.isString(screens)) {
|
|
screens = { min: screens }
|
|
}
|
|
|
|
if (!Array.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(', ')
|
|
}
|