Git Product home page Git Product logo

monstera's Introduction

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.

monstera's People

Contributors

juice49 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

monstera's Issues

Switch to logical properties

We should switch to CSS logical properties in order to be consistent with what will likely become the standard way to describe directions in CSS.

This will be two phases of work. Initially, the public API should be updated to use logical properties. Once widely available, we should also update the actually CSS properties Monstera creates.

The stack mixin already works like this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.