• Stars
    star
    653
  • Rank 66,644 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Automatically generating a component library from your React components (ES5, ES6, Typescript)

React BlueKit CircleCI Dependency Status

BlueKit usage

BlueKit automatically generates a library from your React components with editable props and live preview.

Point BlueKit to folders with your React components and it will generate a library for you. You'll be able to browse through the components, tweak their props, and see the changes live. Furthermore, any changes that you make to your components' code will be reflected in the library.

DEMO here: http://bluekit.blueberry.io

Install

$ npm install --save react-bluekit

You can use BlueKit via npm script or gulp

Npm script

"scripts": {
  "bluekit": "bluekit --baseDir ./components --paths . --exclude \"./(Layout|StyledComponent).tsx\""
}

Gulpfile configuration

import createBlueKit from 'react-bluekit/lib/createBlueKit';

createBlueKit({
  // your directory where components are located
  baseDir: `${__dirname}/src/browser`,
  // relative paths from base dir where to look for components
  paths: ['./components/', './auth'],
  // relative paths from base dir of files or directories you want to exclude from indexing
  exclude: ['./components/Foo'],
  // set to true when providing simple components such as `export default function MyComponent() { <div>Hello</div> }`
  noSpecialReplacements: true
});

This will provide you with two gulp tasks: build-bluekit and watch-bluekit, which perform static analysis of your components.

You can setup the build of BlueKit on application start and then watch components for changes by editing the default task to:

// from gulp.task('default', ['server']); to:
gulp.task('default', ['build-bluekit', 'server', 'watch-bluekit']);

Do not forget to add it to build process (for example on stage or production):

gulp.task('build', ['build-bluekit', 'build-webpack']);
// make sure that component build is before webpack

It will be built when needed.

Add it to your project

Look at the example directory, you only need to add:

import BlueKit from 'react-bluekit';
import componentsIndex from '../componentsIndex';
import React, { Component } from 'react';

export default class PageWithBlueKit extends Component {
  render() {
    return (
      <BlueKit
        componentsIndex={componentsIndex}

        // display inline (not full page)
        inline

        // this name is used for bluekit local storage as namespace
        // it is optional
        name="MyProjectName"
      />
    );
  }
}

You can also pass children to BlueKit, which will be displayed above the search field (e.g. for themes or other stuff).

To add jsdoc descriptions see example example_components/Checkbox.react.js.

Typescript support

Bluekit automatically finds .tsx files and uses react-docgen-typescript parser for it.

BlueKit development

npm install
cd ./example
npm install
gulp
open http://localhost:3000

This will start the development server and then you can play with components in BlueKit.

Gulp tasks

# generate svg icons from src/icons directory
gulp svg-icon

# run unit tests
gulp ava

# run eslint
gulp eslint

Additional info

BlueKit automatically hides props that donโ€™t affect the componentโ€™s look.

If you get some kind of weird error and BlueKit doesn't load at all, try to reset localStorage by running localStorage.clear();.

Made with love by

More Repositories

1

react-load-script

React component that makes it easy to load 3rd party scripts
JavaScript
361
star
2

redux-file-upload

Redux-friendly file upload made easy
JavaScript
67
star
3

react-svg-icon-generator

Generate React Icon Component from SVG icons to show, resize and recolor them.
JavaScript
65
star
4

onion-form

React Redux form builder with great UX validations
JavaScript
50
star
5

vcr.js

Mock server with Proxy and Record support inspired by ruby VCR.
TypeScript
42
star
6

ts-translate

Translate, Interplate, format text into different localisations for React applications.
TypeScript
34
star
7

translation-server

Stores translations with location and screenshot. Enable users to easily edit translations and then any rails/react application can use them.
Ruby
27
star
8

detect-adblock

Get information about whether the user has enabled AdBlock
JavaScript
25
star
9

redux-preload

Preload actions on both server & client side (allows deep nesting of components)
JavaScript
21
star
10

radium-flex

Radium Flex Box React Components Grid & Box
TypeScript
19
star
11

haystack

Core developer stack for JavaScript applications with server side rendering, code splitting, webpack 3
JavaScript
18
star
12

radium-bootstrap-grid

Bootstrap grid system as React components with inline styles!
JavaScript
18
star
13

js-package-template

Boilerplate for creating a new javascript package
Shell
17
star
14

translation-engine

A Rails engine for sending and receiving translations from Translation Server
JavaScript
14
star
15

blueberry_rails

A Rails application template used at Blueberry Apps.
Ruby
9
star
16

react-svg-icon-live-generator

Live SVG Icon React Component generator website
JavaScript
9
star
17

radium-styled-component

A Radium React component for managing global variables for inline styles.
JavaScript
9
star
18

generate-unit-test

Generates basic unit test for mocha, sinon and chai
JavaScript
5
star
19

gp_webpay

Ruby
4
star
20

devise-login_tracker

Devise strategy that tracks each login with IP address and User agent.
Ruby
3
star
21

bb-toggl

JavaScript
2
star
22

bb-car

JavaScript
2
star
23

js-resources

Resources for JavaScript developers
2
star
24

graphql-playground

JavaScript
2
star
25

netverify-engine

Jumio Netverify integration into Rails app as an engine
Ruby
2
star
26

riga-training-examples

Examples for React.js Riga training
HTML
2
star
27

gulp-font-icons

JavaScript
2
star
28

netverify

Simple integration of Jumio Netverify and Netverify Multi Document for Ruby applications
Ruby
1
star
29

ruby-on-rails-second-round-frontend

Front-end part of our interview test application.
JavaScript
1
star
30

guides

Blueberry Guides
1
star
31

aloe

Aloe is a Rails engine that provides double entry bookkeeping functionality.
Ruby
1
star
32

react-bluekit-web

Web for react-bluekit
JavaScript
1
star
33

react-lessons

JavaScript
1
star