Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Thinking in components

Thinking in components

Components and Web Components

Răzvan Roșu

June 26, 2018
Tweet

More Decks by Răzvan Roșu

Other Decks in Programming

Transcript

  1. Atomic Design • Aimed towards both designers and developers •

    Provides a system for composing components • Offers a tool for keeping track of components
  2. Designers and developers The Component concept needs to be mastered

    by both departments. Bridging the gap between design and development is more important now than ever.
  3. A system for composing components Atomic Design brings us a

    few “new” terms, inspired from chemistry. Combining lesser stages result in greater stages (e.g.: atom + atom = molecule) Atom Molecule Organism Template Page
  4. Atoms In Chemistry, atoms are the basic building blocks of

    matter. In Web Interfaces, atoms are the building blocks of an interface. Atoms cannot be broken down any further. Often, atoms aren’t too useful on their own. e.g.: input, image, button
  5. Molecules In Chemistry, molecules are chemically joined atoms. Also, they

    represent the smallest unit of a compound. In Web Interfaces, molecules consist of two or more atoms. They are the backbone of a more complex system. e.g.: search bar = label + input + button
  6. Organisms In Chemistry, organism are complex systems of chemical compounds.

    The molecule is the smallest unit of a compound*. In Web Interfaces, organisms are a group of different or the same type of molecules. e.g.: header = logo + search bar + menu *the compound is probably missing from the Atomic Design terminology as there was no need for an extra level of component complexity
  7. Templates The Chemistry lessons end here. Templates are wireframes, comprised

    of groups of organisms. They eventually become the production code. e.g.: homepage template = header + hero banner + article(s) + footer
  8. Pages An atomic design Page is a specific instance of

    a template. The template content is replaced with real/sample content. Variations of the content will help identify corner cases and the effectiveness of the system.
  9. Keeping track of components Applications evolve in time. We develop

    new pages, with new components and with new functionality. It is important to index all components.
  10. Enter PatternLab PatternLab is an open-source tool. It’s purpose is

    to help us build user interfaces in a pattern manner based on the atomic design principles. It provides several tools to ease our work: • a pattern starter kit • a design system builder • a viewport resizer PatternLab comes in several editions: Node, Gulp, Grunt, Webpack and PHP
  11. Block Element Modifier (B.E.M.) • Conceived for developing the Yandex

    search engine with minimum effort • Solid naming conventions • Improves code readability • Offers a series of tools
  12. Blocks A block is a top-level abstraction of a new

    component. The block is thought of as a parent. The block’s name can have multiple words separated by 1 hyphen. e.g.: section-promo
  13. Elements Elements are the children of blocks. An element’s name

    is prefixed by the block and double underscore. e.g.: section-promo__banner, section-promo__title
  14. Modifiers Modifiers are meant to manipulate the blocks in order

    to theme or style the particular component without inflicting changes on another module. A modifiers name is prefixed by the block and double hyphens. e.g.: section-promo--active
  15. B.E.M. + preprocessors = <3 B.E.M. methodology results in having

    less CSS selectors, therefore our styles become much cleaner. By introducing a preprocessor into our application build, we take it one step further: component scoping. https://codepen.io/razvan-rosu/pen/QQVrQJ