Merge pull request #109 from adamwathan/add-more-complex-breakpoints
Add ability to define more complex breakpoints
This commit is contained in:
commit
1e3149a876
1 changed files with 19 additions and 14 deletions
|
|
@ -1,21 +1,26 @@
|
|||
import _ from 'lodash'
|
||||
import postcss from 'postcss'
|
||||
|
||||
function buildMediaQuery(breakpoint) {
|
||||
if (_.isString(breakpoint)) {
|
||||
breakpoint = {min: breakpoint}
|
||||
function buildMediaQuery(breakpoints) {
|
||||
if (_.isString(breakpoints)) {
|
||||
breakpoints = {min: breakpoints}
|
||||
}
|
||||
return _(breakpoint).map((value, feature) => {
|
||||
feature = _.get(
|
||||
{
|
||||
min: 'min-width',
|
||||
max: 'max-width',
|
||||
},
|
||||
feature,
|
||||
feature
|
||||
)
|
||||
return `(${feature}: ${value})`
|
||||
}).join(' and ')
|
||||
if (!_.isArray(breakpoints)) {
|
||||
breakpoints = [breakpoints]
|
||||
}
|
||||
return _(breakpoints).map((breakpoint) => {
|
||||
return _(breakpoint).map((value, feature) => {
|
||||
feature = _.get(
|
||||
{
|
||||
min: 'min-width',
|
||||
max: 'max-width',
|
||||
},
|
||||
feature,
|
||||
feature
|
||||
)
|
||||
return `(${feature}: ${value})`
|
||||
}).join(' and ')
|
||||
}).join(', ')
|
||||
}
|
||||
|
||||
export default function(options) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue