2.0.2 • Published 4 years ago

@caiodev/styled-media v2.0.2

Weekly downloads
6
License
MIT
Repository
github
Last release
4 years ago

styled-media 💅

Drone (cloud) npm (scoped) npm bundle size (scoped) Codacy grade npm

Create breakpoints within styled-components as easily and quickly as possible 💅

Installation

yarn

yarn add @caiodev/styled-media

npm

npm i @caiodev/styled-media

Usage

The default breakpoints are the following:

const breakpoints = {
  phone: '420px',
  tablet: '768px',
  desktop: '1200px'
}

Example - with default breakpoint

import styled, { css } from 'styled-components'
import media from '@caiodev/styled-media'

const Header = styled.header`
  width: 100%;
  height: 64px;

  ${media.lessThan(
    'tablet',
    css`
      height: 48px;
    `
  )}
`

const Footer = styled.footer`
  width: 100%;
  height: 64px;

  ${media.greaterThan(
    'desktop',
    css`
      height: 80px;
    `
  )}
`

Example - with custom breakpoints

import styled, { css } from 'styled-components'
import media from '@caiodev/styled-media'

const Header = styled.header`
  width: 100%;
  height: 64px;

  ${media.lessThan(
    600,
    css`
      height: 48px;
    `
  )}
`

const Footer = styled.footer`
  width: 100%;
  height: 64px;

  ${media.greaterThan(
    600,
    css`
      height: 80px;
    `
  )}
`
2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.2.0

4 years ago

1.3.0

4 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago