Security News
Combatting Alert Fatigue by Prioritizing Malicious Intent
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
fela-plugin-responsive-value
Advanced tools
This plugin adds support for responsive values as pioneered by styled-system where one passes an array of values that later resolved to respective media queries.
Warning: This package might clash with fela-plugin-fallback-value and thus requires a list of whitelisted properties. We recommend using it before the fallback value.
yarn add fela-plugin-responsive-value
You may alternatively use npm i --save fela-plugin-responsive-value
.
Make sure to read the documentation on how to use plugins.
import { createRenderer } from 'fela'
import responsiveValue from 'fela-plugin-responsive-value'
const renderer = createRenderer({
plugins: [ responsiveValue() ]
})
Parameter | Value | Default | Description |
---|---|---|---|
getMediaQueries | (Function) | Resolve the list of media queries used based on the values and props | |
properties | (Object) | A map of property-boolean pairs of which properties are resolved |
import { createRenderer } from 'fela'
import responsiveValue from 'fela-plugin-responsive-value'
// if we have 2 values, use default and large media query
// if we get 3, also use a tablet media query in between
const getMediaQueries = (values, props) => {
if (values.length === 2) {
return ["@media (min-width: 1024px)"]
}
return ["@media (min-width: 800px)", "@media (min-width: 1024px)"]
}
const renderer = createRenderer({
plugins: [
responsiveValue(getMediaQueries, {
padding: true,
margin: true
})
]
})
Using the above example code:
{
margin: [0, 10]
padding: [5, 10, 15]
}
{
margin: 0,
padding: 5,
"@media (min-width: 800px)": {
padding: 10
},
"@media (min-width: 1024px)": {
margin: 10,
padding: 15
}
}
Fela is licensed under the MIT License.
Documentation is licensed under Creative Common License.
Created with ♥ by @robinweser and all the great contributors.
11.1.1 / 11.1.2
| Package | Changes |
| --- | --- |
| react-fela<br>preact-fela<br>infero-fela<br>reason-fela<br>fela-bindings | (#765) Fixed some regressions with missing exports concerning renderToNodeList
|
FAQs
Fela plugin to resolve responsive array values
The npm package fela-plugin-responsive-value receives a total of 3,031 weekly downloads. As such, fela-plugin-responsive-value popularity was classified as popular.
We found that fela-plugin-responsive-value demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.