sndrs / css-in-js-mq

css-in-js-mq POC

Home Page:https://sndrs.github.io/css-in-js-mq

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

n.b. work on this has been moved to https://github.com/src-mq/src-mq

Proof of concept for css-in-js-mq:

import { from, until } from 'css-in-js-mq'

const style = {
    color: 'red',

    [until.xSmall()]: {
        color: 'blue',
    },

    [from.small()]: {
        color: 'blue',
    },

    [from.medium.until.large()]: {
        color: 'green',
    },
}

Options

Breakpoint methods can also take 2 options:

import { from, until } from 'css-in-js-mq'

const style = {
    [until.xSmall({ and: ['(prefers-reduced-motion: reduce)'] })]: {
        color: 'blue',
    },

    [until.xSmall({ media: ['print'] })]: {
        color: 'blue',
    },
}

Live example: https://sndrs.github.io/css-in-js-mq

About

css-in-js-mq POC

https://sndrs.github.io/css-in-js-mq


Languages

Language:TypeScript 86.7%Language:HTML 7.8%Language:JavaScript 5.6%