Giter VIP home page Giter VIP logo

danilowoz / react-atomic-design Goto Github PK

View Code? Open in Web Editor NEW
1.7K 32.0 205.0 270 KB

🔬 How the Atomic Design methodology can create a great design system from scratch and make better developers.

Home Page: https://danilowoz.com/blog/atomic-design-with-react

CSS 20.33% JavaScript 79.67%
css-architecture design-patterns react atomic-design atomic-css boilerplate storybook css-modules flowtype

react-atomic-design's Introduction

atomic design

react-atomic-design

This is a boilerplate with the methodology Atomic Design using a few cool things, like Storybook, Flow and CSS Modules. Feel free to test, change e adapt everything.

Read full article

What is Atomic Design?

Popularly known within the design world, Atomic Design helps to build consistent, solid and reusable design systems. Plus, in the world of React, Vue and frameworks that stimulate the componentization, Atomic Design is used unconsciously; but when used in the right way, it becomes a powerful ally for developers.

The name Atomic Design comes from the idea of separating the components in atoms, molecules, organisms, templates and pages, like in the image above. But what are the responsibilities of each separated part?

Atoms

atoms

Atoms are the smallest possible components, such as buttons, titles, inputs or event color pallets, animations, and fonts. They can be applied on any context, globally or within other components and templates, besides having many states, such as this example of button: disabled, hover, different sizes, etc.

Molecules

molecules

They are the composition of one or more components of atoms. Here we begin to compose complex components and reuse some of those components. Molecules can have their own properties and create functionalities by using atoms, which don’t have any function or action by themselves.

Organisms

organisms

Organisms are the combination of molecules that work together or even with atoms that compose more elaborate interfaces. At this level, the components begin to have the final shape, but they are still ensured to be independent, portable and reusable enough to be reusable in any content.

Templates

templates

In this state we stop composing components and begin to set their context. Moreover, the templates create relationships between the organisms and others components through positions, placements and patterns of the pages but it doesn’t have any style, color or component rendered. That’s why it looks like a wireframe.

Pages

pages

Pages are the navigate parts of the application and it’s where the components are distributed in one specific template. The components get real content and they’re connected with the whole application. At this stage, we can test the efficiency of the design system to analyse if all the components are independent enough or if we need to split them in smaller parts.

React + Atomic Design

When we started to use Atomic Design within React we had to adjust some rules of the methodology to ensure that components were reused as much as possible, that they were stateless, without styles of positions and very specific margins so to avoid any side effects in the pages of application.

So with each new component we asked ourselves: “Are these components generic enough to avoid specificity and/or repeated code in whatever context they are used?”

So we were able to write a few rules:

  • The Atomic Design should have a file of variables and it must be imported by each component;
  • The atoms should be written without margins and positions;
  • Only the molecules and organisms can set the positions of atoms, but these stacks can’t have any styles of margins and positions;
  • Templates have only one function: to set the grid of pages but never positions of specific components;
  • Pages render the components with a template defined and it’s here that the Atomic Design will be connected to the rest of the application;

Scripts

Script Desc
$ yarn start Start a simple webpack server
$ yarn dev Create a server to development at port 5000
$ yarn storybook Start Storybook with the stories imported
$ yarn flow Validate the flow types

Libraries

  • Webpack
    • CSS Loader
    • SVG Sprite loader
    • File loader
  • Flow types
  • Storybook
    • Storybook Info
  • CSS
    • Autoprefixer
    • Import
    • Nested
    • Variables
    • Inline SVG
  • Babel
    • Loader
    • Preset ES2015
  • Project
    • Atomic Design styles folder structure
    • ESLint
    • Prettier

Contributors

@danilowoz

@dleitee

License

MIT

react-atomic-design's People

Contributors

danilowoz avatar dependabot[bot] avatar jigz avatar moerazem avatar

Stargazers

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

Watchers

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

react-atomic-design's Issues

"yarn start" & "yarn dev" fail on Windows 10

$ yarn start
yarn run v1.6.0
$ node dist-server/server.js
module.js:557
throw err; ^

Error: Cannot find module 'C:\Users\sandeda\Documents\GitHub\react-atomic-design\dist-server\server.js'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Function.Module.runMain (module.js:701:10)
at startup (bootstrap_node.js:193:16)
at bootstrap_node.js:617:3
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

$ yarn dev
yarn run v1.6.0
$ NODE_ENV=development PORT=5000 node server.dev.js
'NODE_ENV' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

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.