28
COMPONENT DRIVEN DEVELOPMENT Creating the UI components in the clever way

COMPONENT - Reacticon · @igloczek #Reacticon It is a process that builds UIs from the “bottom up” by starting at the level of components and ending at the level of pages or screens

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: COMPONENT - Reacticon · @igloczek #Reacticon It is a process that builds UIs from the “bottom up” by starting at the level of components and ending at the level of pages or screens

COMPONENT DRIVEN DEVELOPMENTCreating the UI components in the clever way

Page 2: COMPONENT - Reacticon · @igloczek #Reacticon It is a process that builds UIs from the “bottom up” by starting at the level of components and ending at the level of pages or screens

BARTEK IGIELSKI Lead Front-end Developer @ SNOW.DOG

Core team member @ Vue Storefront Founder of Frontools / SASS Blank / Alpaca

twitter @igloczek facebook /iglodottech

Page 3: COMPONENT - Reacticon · @igloczek #Reacticon It is a process that builds UIs from the “bottom up” by starting at the level of components and ending at the level of pages or screens

#Reacticon@igloczek

Component-Driven Development (CDD) is a development methodology that anchors the

build process around components.

Page 4: COMPONENT - Reacticon · @igloczek #Reacticon It is a process that builds UIs from the “bottom up” by starting at the level of components and ending at the level of pages or screens

#Reacticon@igloczek

It is a process that builds UIs from the “bottom up” by starting at the level of components and ending

at the level of pages or screens.

Page 5: COMPONENT - Reacticon · @igloczek #Reacticon It is a process that builds UIs from the “bottom up” by starting at the level of components and ending at the level of pages or screens

BENEFITS

Page 6: COMPONENT - Reacticon · @igloczek #Reacticon It is a process that builds UIs from the “bottom up” by starting at the level of components and ending at the level of pages or screens

#Reacticon@igloczek

• Focus on one thing at a time

• Live documentation

• Components library

• Simpler environment

• Parallel development

• Visual testing

• Faster feedback

• Working without backend

Page 7: COMPONENT - Reacticon · @igloczek #Reacticon It is a process that builds UIs from the “bottom up” by starting at the level of components and ending at the level of pages or screens

STORYBOOK

Page 8: COMPONENT - Reacticon · @igloczek #Reacticon It is a process that builds UIs from the “bottom up” by starting at the level of components and ending at the level of pages or screens

#Reacticon@igloczek

Storybook is framework / library agnostic

React Storybook -> Storybook

Page 9: COMPONENT - Reacticon · @igloczek #Reacticon It is a process that builds UIs from the “bottom up” by starting at the level of components and ending at the level of pages or screens

#Reacticon@igloczek

Page 10: COMPONENT - Reacticon · @igloczek #Reacticon It is a process that builds UIs from the “bottom up” by starting at the level of components and ending at the level of pages or screens

#Reacticon@igloczek

Storybook is a UI development environment that will help you visualise different states of

UI components and develop them interactively.

Page 11: COMPONENT - Reacticon · @igloczek #Reacticon It is a process that builds UIs from the “bottom up” by starting at the level of components and ending at the level of pages or screens

#Reacticon@igloczek

Storybook runs outside of your app, so you are developing UI components in isolation.

Page 12: COMPONENT - Reacticon · @igloczek #Reacticon It is a process that builds UIs from the “bottom up” by starting at the level of components and ending at the level of pages or screens

#Reacticon@igloczek

Page 13: COMPONENT - Reacticon · @igloczek #Reacticon It is a process that builds UIs from the “bottom up” by starting at the level of components and ending at the level of pages or screens

HOW TO

CREATE STORIES

Page 14: COMPONENT - Reacticon · @igloczek #Reacticon It is a process that builds UIs from the “bottom up” by starting at the level of components and ending at the level of pages or screens

#Reacticon@igloczek

Story should represent a single state of one of your components, be like a visual test case.

Page 15: COMPONENT - Reacticon · @igloczek #Reacticon It is a process that builds UIs from the “bottom up” by starting at the level of components and ending at the level of pages or screens

#Reacticon@igloczek

import { storiesOf } from '@storybook/vue'

import App from '../components/01-globals/app/App.vue' import Icon from '../components/01-globals/icon/Icon.vue'

storiesOf('Global/Icon', module) .add('Default', () => ({ components: { App, Icon }, template: ` <app> <icon icon="arrow-down" /> </app> `, }))

Page 16: COMPONENT - Reacticon · @igloczek #Reacticon It is a process that builds UIs from the “bottom up” by starting at the level of components and ending at the level of pages or screens

#Reacticon@igloczek

Technically story is a function… …so sky is the limit

Fake data? Fetch them from reqres.in Static data? Import a local file

Requests mocking? axios-mock-adapter is waiting GraphQL mocking? Apollo server supports it

Page 17: COMPONENT - Reacticon · @igloczek #Reacticon It is a process that builds UIs from the “bottom up” by starting at the level of components and ending at the level of pages or screens

MORE FEATURES

Page 18: COMPONENT - Reacticon · @igloczek #Reacticon It is a process that builds UIs from the “bottom up” by starting at the level of components and ending at the level of pages or screens

#Reacticon@igloczek

Storybook is extendable using addons

https://storybook.js.org/addons/addon-gallery/

https://storybook.js.org/basics/live-examples/

Page 19: COMPONENT - Reacticon · @igloczek #Reacticon It is a process that builds UIs from the “bottom up” by starting at the level of components and ending at the level of pages or screens

#Reacticon@igloczek

You can also build a static version of your storybook and deploy it anywhere you want.

Page 20: COMPONENT - Reacticon · @igloczek #Reacticon It is a process that builds UIs from the “bottom up” by starting at the level of components and ending at the level of pages or screens

TESTING

Page 21: COMPONENT - Reacticon · @igloczek #Reacticon It is a process that builds UIs from the “bottom up” by starting at the level of components and ending at the level of pages or screens

#Reacticon@igloczek

Reasons for Testing • To find bugs • To make sure things won’t break between

new code commits • To keep tests as living documentations

Page 22: COMPONENT - Reacticon · @igloczek #Reacticon It is a process that builds UIs from the “bottom up” by starting at the level of components and ending at the level of pages or screens

#Reacticon@igloczek

Structural testing Check if the structure of UI and how it’s laid

out, for example check if the form have inputs, labels, submit buttons etc.

Page 23: COMPONENT - Reacticon · @igloczek #Reacticon It is a process that builds UIs from the “bottom up” by starting at the level of components and ending at the level of pages or screens

#Reacticon@igloczek

Interaction testing Check if the UI responds to actions in the

predictable way, for example check if form will display status message after submitting it.

Page 24: COMPONENT - Reacticon · @igloczek #Reacticon It is a process that builds UIs from the “bottom up” by starting at the level of components and ending at the level of pages or screens

#Reacticon@igloczek

CSS / Style / Visual testing This is a pretty complex subject and usually

should be done by comparing images of rendered components.

Page 25: COMPONENT - Reacticon · @igloczek #Reacticon It is a process that builds UIs from the “bottom up” by starting at the level of components and ending at the level of pages or screens

ANNOUNCEMENTS

Page 26: COMPONENT - Reacticon · @igloczek #Reacticon It is a process that builds UIs from the “bottom up” by starting at the level of components and ending at the level of pages or screens

#Reacticon@igloczek

Components based Magento 2 theme v1.0.0 release - 15 October 2018

https://github.com/snowdogapps/magento2-alpaca-theme

https://github.com/SnowdogApps/magento2-alpaca-components

Components demo - https://bit.ly/2O5L6dA

Page 27: COMPONENT - Reacticon · @igloczek #Reacticon It is a process that builds UIs from the “bottom up” by starting at the level of components and ending at the level of pages or screens

#Reacticon@igloczek

Vue Storefront theme based on Alpaca Soon!

https://github.com/SnowdogApps/alpaca-storybook

Page 28: COMPONENT - Reacticon · @igloczek #Reacticon It is a process that builds UIs from the “bottom up” by starting at the level of components and ending at the level of pages or screens

THANK YOU!