mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
* add normalizeScreens function This will allow us to normalize the various kinds of inputs to a stable version that is consistent regardless of the input. * use normalized screens * add dedicated test for new tuple syntax * make test consistent with other tests While working on the normalizeScreens feature, some tests started failing (the one with multiple screens), while looking at them I made them consistent with the rest of the codebase. * add test to ensure consistent order in screens output * update changelog * Update CHANGELOG.md * Update CHANGELOG.md Co-authored-by: Adam Wathan <adam.wathan@gmail.com>
21 lines
484 B
JavaScript
21 lines
484 B
JavaScript
export default function buildMediaQuery(screens) {
|
|
screens = Array.isArray(screens) ? screens : [screens]
|
|
|
|
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(', ')
|
|
}
|