• Stars
    star
    442
  • Rank 98,677 (Top 2 %)
  • Language
    JavaScript
  • Created over 6 years ago
  • Updated about 6 years ago

Reviews

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

Repository Details

Dumb React

Dumb React is a collection of React components used to create a static (dumb) website screen. Why do this? Many React tutorials or boilerplates I've encountered are either too basic ("here's a button component!") or more often too complex ("here's a simple babel typescript redux cssmodules isometric oh god oh god oh god..."). I wanted to be able to draw a straight line from how a simple component ("atom" in atomic design speak) makes its way into a full page.

There are a ton of different ways to build reusable components and put dynamic content inside them, and many teams β€” even ones that aren't building highly-interactive web apps that would actually benefit from a tool like React β€” are reaching for React to create component-driven experiences. So in that spirit, I wanted to create a demo that shows how to construct a whole screen (even if it's a dumb, static one) out of React components.

More info in my blog post

React w/ Storybook Starter

This repo is a fork of Micah Godbolt's React with Storybook Starter, which is a combination of Create React App and the Storybook CLI. The stories folder has been changed to components and a new Button component has been scaffolded and used in the application.

Using This Repo

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

Building components

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

- ComponentName
  - Component.css
  - ComponentName.stories.js
  - ComponentName.js

Create src/components/Button and add Button.css, Button.js and Button.stories.js

Button.js will be:

import React, { Component } from 'react';
import './Button.css';

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>
);

Button.css is plain CSS, but will automatically be loaded when the component is used.

Run Storybook

npm run storybook

Add Button to App.js

import React, { Component } from 'react';
import { Button } from './components/Button/Button';

class App extends Component {
  render() {
    return (
      <div className="App">
        <Button onClick={() => alert('i was clicked!')} > Click Me Please </Button>
      </div>
    );
  }
}

export default App;

Run the application

npm start

Adding Sass

Adding Sass involves "ejecting" out of create react app. This process is out of the scope of this demo, but I'll include some links below.

More Repositories

1

frontend-guidelines-questionnaire

A one-page questionnaire to help your team establish effective frontend guidelines, so that you can write consistent & cohesive code together.
2,578
star
2

this-is-responsive

This Is Responsive
HTML
1,586
star
3

atomic-design

The repository for the Atomic Design book
SCSS
1,236
star
4

style-guide-guide

A boilerplate for creating your own custom style guide
HTML
1,226
star
5

project-hub

An HTML template for project timelines
CSS
913
star
6

patternlab

Make a pattern library using atomic design.
JavaScript
844
star
7

ish.

ish. is yet another viewport resizer
JavaScript
731
star
8

gatsby-style-guide-guide

A boilerplate for creating your own custom style guide
JavaScript
467
star
9

labelmask

A way to create accessible input hinting without using input masks.
JavaScript
205
star
10

design-system-questionnaire

A questionanaire for creating effective design systems
92
star
11

Mobile-First-RWD

An example of a mobile-first responsive web design
JavaScript
68
star
12

dumb-react-sass

CSS
41
star
13

vue-design-system-demo

JavaScript
16
star
14

pittsburgh-food-bank-timeline

The project timeline for the Pittsburgh Food Bank open redesign
CSS
14
star
15

vanilla-pl-hbs

Vanilla Pattern Lab Handlebars Starter Kit
CSS
13
star
16

progress

All the progress on all my current projects
HTML
11
star
17

vanilla-pl

CSS
8
star
18

cn-style-guide

HTML
8
star
19

pittsburgh-food-bank

Pittsburgh Food Bank Website Redesign
JavaScript
6
star
20

czi-vanilla-storybook

JavaScript
5
star
21

deathtobullshit

Death to Bullshit
HTML
4
star
22

one-click-hugo-cms

CSS
4
star
23

pittsburgh-food-bank-wordpress

Custom Wordpress theme for the Greater Pittsburgh Community Food Bank
JavaScript
3
star
24

frost-finery-pl

Pattern Lab repo for Frost Finery
JavaScript
2
star
25

pghdevicelab

Pittsburgh Open Device Lab website
CSS
2
star
26

patternlab-handlebars-ecommerce-demo-example

HTML
2
star
27

patternlab-website-pl

HTML
2
star
28

test-jekyll-netlify

Ruby
1
star
29

pl-website-eleventy

CSS
1
star
30

frost-finery-wp

Wordpress theme for frostfinery.com
PHP
1
star
31

pattern-lab-ecommerce-handlebars

CSS
1
star
32

try_git

1
star
33

frost-frost-wp

Wordpress theme for frostfrost.com
PHP
1
star