2.0.0 • Published 3 years ago

monstera v2.0.0

Weekly downloads
4
License
ISC
Repository
github
Last release
3 years ago

Monstera

Monstera is a CSS-in-JS helper library. I created it because I really like Styled System, but I also really like CSS Custom Properties.

Config

Breakpoints

Monstera is designed to use CSS Custom Properties instead of a JavaScript theme object.

Media query breakpoints cannot be stored in Custom Properties. Hopefully CSS Environment Variables will provide a way to store breakpoints in CSS.

For now, Monstera breakpoints must be defined in a Styled Components theme.

import React from 'react'
import { Theme } from 'monstera'
import { ThemeProvider } from 'styled-components'

const theme: Theme = {
  breakpoints: [
    [30, 'em'],
    [45, 'em'],
    [60, 'em'],
  ],
}

const App: React.FC = () => (
  <ThemeProvider theme={theme}>
    <p>The ringing in my ears is from another life.</p>
  </ThemeProvider>
)

CSS Custom Properties

Space

Define a space range using --spaceN Custom Properties. For example:

:root {
  --space1: 1rem;
  --space2: 1.5rem;
  --space3: 2.5rem;
}

Utilities

Mixins

Todo

  • Test Monstera with zero-runtime CSS-in-JS libraries, such as Linaria.
2.0.0

3 years ago

1.1.0

3 years ago

1.0.0

4 years ago