Code Monkey home page Code Monkey logo

expand-components's Introduction

Expand UI

license

Expand UI & Modules is a collection of React components, tools and guidelines for creating expand products.

  • Modules npm version: Dynamic extensible JSON powered form library for React.
  • UI Components npm version: set of components such as Buttons, Panels, Menus, HOC's. General purpose components used to build expand.org web applications.
  • UI Kit npm version: Colors, and Typography used across expand.org apps

Documentation and live playground

Detailed documentation and forms playground is available in docz

https://expandorg.github.io/expand-components/

installation

Expand components library is a set of public npm packages: @expandorg/components, @expandorg/modules, @expandorg/uikit:

npm install  @expandorg/modules @expandorg/components @expandorg/uikit --save

Prerequisites

expand UI & Modules use stylus and css-modules by default to import stylesheets. It is necessary to import .styl files located in node_modules. We recommend using webpack, but other bundlers can be configured.

Here is webpack config example

// webpack.config.babel.js
export default (env = {}) => {
  const dev = !!env.dev;
  return {
    ...
    module: {
      rules: [
        {
          test: /^((?!\.module).)*\.styl$/,
          use: [
            'style-loader',
            'css-loader?sourceMap&importLoaders=2',
            'postcss-loader?sourceMap',
            'stylus-loader?paths[]=src',
          ],
          exclude: /node_modules\/(?!(@expandorg)\/).*/,
        },
        {
          test: /\.module\.styl$/,
          use: [
            'style-loader',
            `css-loader?sourceMap&importLoaders=2&modules&localIdentName=${dev ? '[local]__[path][name]__' : ''}[hash:base64:5]`,
            'postcss-loader?sourceMap',
            'stylus-loader?paths[]=src',
          ],
          exclude: /node_modules\/(?!(@expandorg)\/).*/,
        }
      ],
    },
  };
};

Basic Usage

import React from 'react'
import { Button } from '@expandorg/components';

const MyComponent = () => (
  <Button theme="secondary" onClick={() => console.log('click!')}>
    Hello World
  </Button>
);

Modules Form Usage

import React from 'react'
import { Form, formProps, FormDataProvider } from '@expandorg/modules';


const form = {   // define form modules
  modules: [{
    name: "input-1",
    type: "input",
    placeholder: "Input value"
  }]
}


class CustomForm extends Component {    // your form component

  handleSubmit = values => {
    console.log(values);
  };

  render() {
    return (
      <FormDataProvider formData={null}>
        <Form
          form={form}
          onSubmit={this.handleSubmit}
        >
          {moduleProps => <Module {...moduleProps} />}
        </Form>
      </FormDataProvider>
    );
  }
}

License

This project is licensed under the terms of Mozilla Public License 2.0.

expand-components's People

Contributors

dependabot[bot] avatar jaschaephraim avatar kieranoreilly avatar sslava avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

djohn30 codeaudit

expand-components'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.