GithubHelp home page GithubHelp logo

ezhangle / reactcss Goto Github PK

View Code? Open in Web Editor NEW

This project forked from casesandberg/reactcss

0.0 2.0 0.0 4.68 MB

Bringing Classes to Inline Styles

Home Page: http://reactcss.com/

License: MIT License

JavaScript 28.82% CoffeeScript 71.18%

reactcss's Introduction

  • "Pop" classes on and off: Use a class-based data structure, similar to traditional modifier css, that can be applied conditionally.
  • Keep styles in one place: Html and components styles stay together. Separate the style logic from the display and business logic.
  • Simple to attach to elements: Use the "is" syntax to effortlessly attach inline styles to html elements and spreads to custom components.

Sample Component

Sample Component with ReactCSS

Installation & Usage

npm install reactcss --save

Extend ReactCSS

var ReactCSS = require('reactcss');

class Button extends ReactCSS.Component {
  ...
}

Put in a Default Class

var ReactCSS = require('reactcss');

class Button extends ReactCSS.Component {

  classes() {
    return {
      'default': {
        modal: {
          background: '#fff',
          boxShadow: '0 2px 4px rgba(0, 0, 0, .48)'
        },
        title: {
          fontSize: '24px'
        },
        Content: {
          type: 'modal-content',
          padding: '20px'
        }
      }
    }
  }

  ...
}

Attach styles to HTML

See react-map-styles

var ReactCSS = require('reactcss');

class Button extends ReactCSS.Component {
  ...

  render() {
    return (
      <div is="modal">
        <div is="title">{ this.props.title }</div>
        <Content is="Content" />
      </div>
    )
  }
}

Documentation

See the Full Documentation

reactcss's People

Contributors

casesandberg avatar vladikoff avatar

Watchers

 avatar  avatar

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.