Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Latest commit 84e5545 Jan 9, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.storybook Add knobs to addons Jan 8, 2019
public Remove old icons.svg from another project. Nov 28, 2018
src Refactored tokens into JS file rather than stories Dec 5, 2018
.babelrc Added the babel transpile commands/node modules for publishing to npm Dec 5, 2018
.editorconfig Add Prettier config file and editor config Nov 14, 2018
.gitignore Add dist to gitignore Jan 9, 2019
.npmignore Added the babel transpile commands/node modules for publishing to npm Dec 5, 2018
.prettierrc
README.md Copy changes Jan 9, 2019
package-lock.json Update babel cli Jan 9, 2019
package.json Rename Jan 8, 2019

README.md

Vanilla React

Vanilla React is a barebones UI starter kit that uses Create React App and Storybook.

Using This Repo

To get started, type the following commands into the terminal:

  • git clone https://github.com/bradfrost/vanilla-react.git && cd vanilla-react
  • npm install
  • npm run storybook will start the storybook.

Building components

Start building in the src/components folder with this folder structure:

- ComponentName
  - ComponentName.js
  - ComponentName.scss
  - ComponentName.stories.js

For instance, create src/components/Button and add Button.scss, Button.js and Button.stories.js

Button.js will be something along the lines of:

import React, { Component } from "react";
import "./Button.scss";

export class Button extends Component {
    render() {
        return (
            <button className="Button" {...this.props}>
                {this.props.children}
            </button>
        );
    }
}

Button.stories.js will be:

import React from "react";
import { storiesOf } from "@storybook/react";
import { Button } from "./Button";

let stories = storiesOf("Button", module);

stories.add("Default", () => (
    <Button onClick={() => console.log("clicked!!")}>Hello Button</Button>
));

Run Storybook

npm run storybook

Create React Scripts

npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

npm test

Launches the test runner in the interactive watch mode.
See the section about running tests for more information.

npm run build

Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.
Your app is ready to be deployed!

See the section about deployment for more information.

npm run eject

Note: this is a one-way operation. Once you eject, you can’t go back!

If you aren’t satisfied with the build tool and configuration choices, you can eject at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use eject. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

Learn More

You can learn more in the Create React App documentation.

To learn React, check out the React documentation.

You can’t perform that action at this time.