tailwindcss/src/util/buildMediaQuery.js

21 lines
484 B
JavaScript
Raw Permalink Normal View History

export default function buildMediaQuery(screens) {
screens = Array.isArray(screens) ? screens : [screens]
2017-10-06 10:09:37 -04:00
return screens
.map((screen) =>
screen.values.map((screen) => {
if (screen.raw !== undefined) {
return screen.raw
}
return [
screen.min && `(min-width: ${screen.min})`,
screen.max && `(max-width: ${screen.max})`,
]
.filter(Boolean)
.join(' and ')
})
)
.join(', ')
2017-10-06 10:09:37 -04:00
}