Coder Social home page Coder Social logo

fain's Introduction

fain

React components based on ZURB Foundation Sites using CSS modules.

Take a look at the Component Reference for an overview of the available components with their props and current status.

Install

To use these components you need an assets build process (Webpack, Browserify, etc) with Sass and CSS Modules support.

  1. Install package:
    npm install fain --save
  2. Install peer dependencies:
    npm install foundation-sites react --save
  3. Setup CSS modules in your assets build process configuration.
    • Enable the camelCase option
    • Add the node_modules dir to your sass.includePaths

Webpack

Use sass-loader with css-loader.

// webpack.config.js

module.exports = {
  // ...
  loaders: [
    //...
    {
      test: \/.scss?$/,
      loader: [
        'style-loader',
        'css-loader?camelCase=1',
        `sass-loader?includePaths[]=${path.resolve('./node_modules')}`
      ]
    },
    //...
  ],
  //...
};

Customization

Themability for components is available using Foundation SASS variables.

Webpack

Prepend your _settings.scss to the files that will load the fain components.

// webpack.config.js

// ...
function getSassSettings() {
  var data = fs.readFileSync(path.resolve('./styles/_settings.scss'));
  return global.encodeURIComponent(data.toString('utf-8'));
}
// ...
module.exports = {
  // ...
  loaders: [
    //...
    {
      test: \/.scss?$/,
      loader: [
        'style-loader',
        'css-loader?camelCase=1',
        `sass-loader?data=${getSassSettings()}&includePaths[]=${path.resolve('./node_modules')}`
      ]
    },
    //...
  ],
  // ...
};

TODO: add babel examples of prepending a settings file

Usage

import React, { PropTypes } from 'react';

import Button from 'fain/controls/Button';

function Root() {
  render() {
    return (
      <div>
        <Button
          color="primary"
          size="large"
        >Sign In</Button>
      </div>
    );
  }
}

export default Root;

For more examples, head over to the Component Reference.

fain's People

Contributors

guzart avatar

Watchers

 avatar  avatar

fain's Issues

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.