1.0.2 • Published 7 years ago

mqcss v1.0.2

Weekly downloads
1
License
ISC
Repository
github
Last release
7 years ago

mqcss

npm npm JavaScript Style Guide styled with prettier

Introduction

mqcss is a media query helper.

Installation

npm install mqcss --save
yarn add mqcss

Usage

Play with it here

Example

import React from 'react'
import styled from 'styled-components'
import jss from 'jss'
import { onMobile, onTablet } from 'mqcss'

// styled-components
// Different border on mobile & table
const Wrapper = styled.div`
  border: 1px solid black;
  padding: ${p => toPx(p.padding) || '10px'};
  > * { margin: 0 5px; }

  ${onMobile} {
    border: 1px solid red;
  }

  ${onTablet} {
    border: 1px solid blue;
  }
`
// jss
// smaller font size on mobile
const styles = {
  button: {
    fontSize: 12,
    [onMobile]: {
      fontSize: 8
    }
  }
}

const {classes} = jss.createStyleSheet(styles).attach()