Socket
Socket
Sign inDemoInstall

facepaint

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

facepaint

Responsive style values for css-in-js.


Version published
Weekly downloads
90K
decreased by-5.46%
Maintainers
1
Weekly downloads
 
Created
Source

facepaint

Responsive style values for css-in-js.

Example

import { css } from 'emotion'
import facepaint from 'facepaint'

const mq = facepaint(css, [
  '@media(min-width: 420px)',
  '@media(min-width: 920px)',
  '@media(min-width: 1120px)'
])

const myClassName = mq({
  width: ['25%', '50%', '75%', '100%'],
  '& .foo': {
    color: ['red', 'green', 'blue', 'darkorchid'],
    '& img': {
      height: [10, 15, 20, 25]
    }
  }
})

Note that the first value is considered a default value and is not a child of a media query at-rule.

The following css is generated.

.css-1ohjc6h {
  width: 25%;
}

@media (min-width:420px) {
  .css-1ohjc6h {
    width: 50%;
  }
}

@media (min-width:920px) {
  .css-1ohjc6h {
    width: 75%;
  }
}

@media (min-width:1120px) {
  .css-1ohjc6h {
    width: 100%;
  }
}

.css-1ohjc6h .foo {
  color: red;
}

@media (min-width:420px) {
  .css-1ohjc6h .foo {
    color: green;
  }
}

@media (min-width:920px) {
  .css-1ohjc6h .foo {
    color: blue;
  }
}

@media (min-width:1120px) {
  .css-1ohjc6h .foo {
    color: darkorchid;
  }
}

.css-1ohjc6h .foo img {
  height: 10px;
}

@media (min-width:420px) {
  .css-1ohjc6h .foo img {
    height: 15px;
  }
}

@media (min-width:920px) {
  .css-1ohjc6h .foo img {
    height: 20px;
  }
}

@media (min-width:1120px) {
  .css-1ohjc6h .foo img {
    height: 25px;
  }
}

Keywords

FAQs

Package last updated on 22 Oct 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc