SlideShare a Scribd company logo
1 of 46
Download to read offline
DESIGN FORDESIGN FOR
SUCCESSSUCCESS
WITH REACT AND STORYBOOKSWITH REACT AND STORYBOOKS
CHRIS SAYLORCHRIS SAYLOR
LEAD ENGINEER @ ZUMBALEAD ENGINEER @ ZUMBA
@cjsaylor
DESIGN?DESIGN?
THAT'S SOMEONE ELSES JOB.THAT'S SOMEONE ELSES JOB.
Ugh, another sketch/photoshop slice job. Maybe, if I
had been involved...
WHY DO WE DO IT?WHY DO WE DO IT?
No code involved, so designers can work completely
independently
Developers usually viewed as "bad" designers
COMMON DESIGN WORKFLOWCOMMON DESIGN WORKFLOW
= ?= ?
Image source: @nicolesaidy
HAVING DESIGNS DELIVERED:HAVING DESIGNS DELIVERED:
Design elements tend to be "pages" and not
components
Can't easily show animations or responsive designs
Version control?
Some things may not be possible (or realistic) in a
browser
Still have a lot of work to "translate" to html
... and it may not be pixel perfect!
WHY SHOULD WE CARE ABOUT DESIGN?WHY SHOULD WE CARE ABOUT DESIGN?
Gateway for user acquisition
Can reduce bugs
So ware that isn't used is pointless
WHY SHOULD WE CARE ABOUT DESIGN?WHY SHOULD WE CARE ABOUT DESIGN?
Bad UX designs makes us susceptible to disruption.
HOW DO WE BRIDGEHOW DO WE BRIDGE
THE GAP?THE GAP?
STORYBOOK.JSSTORYBOOK.JS
WHY STORYBOOK.JS?WHY STORYBOOK.JS?
Integrates with React and Vue.js
Immediate feedback of changes
Easily see history of changes
At the end of the design phase, we have functional
components!
HOW?HOW?
Disclaimer: you'll need developer and
designer buy-in
KEEP DATA RETRIEVAL SEPARATEKEEP DATA RETRIEVAL SEPARATE
Avoid state in your views as much as possible
Compose your components as much as possible
Use props to pass in data
TYPICAL REACT TUTORIAL COMPONENTTYPICAL REACT TUTORIAL COMPONENT
export default class ListComponent extends React.Component {
state = { items: [] }
async componentDidMount() {
this.setState({
items: await fetch('/items')
});
}
renderItems() {
return this.state.items.map(item => <li>{item}</li>)
}
render = () => (
<ul>{ this.renderItems() }</ul>
)
}
SEPARATE!SEPARATE!
USE PROPS TO DISPLAYUSE PROPS TO DISPLAY
export default class ListComponent extends React.Component {
renderItems = () => {
return (this.props.items || [])
.map(item => <li>{item}</li>)
}
render = () => <ul>{ this.renderItems() }</ul>
}
PASS THE STATE DATA TO THE VIEWPASS THE STATE DATA TO THE VIEW
import List from './list-component';
export default class ListContainer extends React.Component {
state = { items: [] }
async componentDidMount() {
this.setState({
items: await fetch('/items')
});
}
render = () => <List items={this.state.items}/>
}
STORYTIME!STORYTIME!
import { storiesOf } from '@storybook/react';
import List from './list-component';
storiesOf('List', module)
.add('No items', () => <List />)
.add('One item', () => <List items={['item 1']} />)
.add('Multiple items', () => {
return <List items={['item 1', 'item 2', 'item 3']} />
});
STORYBOOK CAPABILITIESSTORYBOOK CAPABILITIES
Show when user actions occur in the view
ADD A CLICK ACTIONADD A CLICK ACTION
export default class ListComponent extends React.Component {
onClick = (e) => {
this.props.onItemClicked(e.target.innerText);
}
renderItems = () => {
return (this.props.items || [])
.map(item => (
<li onClick={this.onClick}>{item}</li>
));
}
render = () => <ul>{ this.renderItems() }</ul>
}
MODIFY OUR STORY FOR THE ACTIONMODIFY OUR STORY FOR THE ACTION
import { storiesOf, action } from '@storybook/react';
import List from './list-component';
storiesOf('List', module)
.add('Multiple items', () => {
return (
<List
onItemClicked={action('Item clicked!')}
items={['item 1', 'item 2', 'item 3']}
/>
);
});
STORYBOOK CAPABILITIESSTORYBOOK CAPABILITIES
Allow User Input In Stories
ADD THE "KNOBS" ADDONADD THE "KNOBS" ADDON
This is what is responsible for showing the panel
// addons.js
import '@storybook/addon-knobs/register';
MODIFY THE STORYMODIFY THE STORY
import { storiesOf, action } from '@storybook/react';
import List from './list-component';
import {withKnobs, array} from '@storybook/addon-knobs';
storiesOf('List', module)
.addDecorator(withKnobs)
.add('Multiple items', () => (
<List
onItemClicked={action('Item clicked!')}
items={
array('Items', [
'item 1',
'item 2',
'item 3'
])
}
/>
));
STORYBOOK CAPABILITIESSTORYBOOK CAPABILITIES
Interactive Unit Tests
CONCLUSIONCONCLUSION
Getting involved in the design process doesn't have
to be scary
Start fresh or add to existing React/VueJS app
Hit the ground running when designs are finished
Version control designs and their stories
RESOURCESRESOURCES
https://github.com/cjsaylor/design-for-success-
slides
https://www.chris-saylor.com/design-for-success-
slides/example
QUESTIONS?QUESTIONS?
REACT-NATIVE CONSIDERATIONSREACT-NATIVE CONSIDERATIONS
REMEMBER THIS?REMEMBER THIS?
import List from './list-component';
export default class ListContainer extends React.Component {
state = { items: [] }
async componentDidMount() {
this.setState({
items: await fetch('/items')
});
}
render = () => <List items={this.state.items}/>
}
REACT DOM & NATIVE...TOGETHER?REACT DOM & NATIVE...TOGETHER?
HIGHER-ORDER COMPONENT (HOC)HIGHER-ORDER COMPONENT (HOC)
Reference:
https://reactjs.org/docs/higher-order-
components.html
export default function withListData(WrappableComponent) {
return class extends React.Component {
state = { items: [] }
async componentDidMount() {
this.setState({
items: await fetch('/items')
});
}
render = () => (
<WrappableComponent items={this.state.items}/>
)
}
}
USING THE NEW HOC IN REACT NATIVEUSING THE NEW HOC IN REACT NATIVE
import List from './native/list-component';
import withListData from 'list-container';
export default class SomeReactView extends React.Component {
componentDidMount() {
this.wrappedList = withListData(<List/>);
}
render() {
if (!this.wrappedList) {
return null;
}
const WrappedList = this.wrappedList;
return <WrappedList/>;
}
}
FINFIN

More Related Content

What's hot

The redux saga begins
The redux saga beginsThe redux saga begins
The redux saga beginsDaniel Franz
 
Introduction to react_js
Introduction to react_jsIntroduction to react_js
Introduction to react_jsMicroPyramid .
 
React event
React eventReact event
React eventDucat
 
Git with t for teams
Git with t for teamsGit with t for teams
Git with t for teamsSven Peters
 
An introduction to React.js
An introduction to React.jsAn introduction to React.js
An introduction to React.jsEmanuele DelBono
 
Flutter Tutorial For Beginners | Edureka
Flutter Tutorial For Beginners | EdurekaFlutter Tutorial For Beginners | Edureka
Flutter Tutorial For Beginners | EdurekaEdureka!
 
Jetpack Compose.pptx
Jetpack Compose.pptxJetpack Compose.pptx
Jetpack Compose.pptxGDSCVJTI
 
Redux Sagas - React Alicante
Redux Sagas - React AlicanteRedux Sagas - React Alicante
Redux Sagas - React AlicanteIgnacio Martín
 
React + Redux Introduction
React + Redux IntroductionReact + Redux Introduction
React + Redux IntroductionNikolaus Graf
 
Get Started with ReactJS 18 Development Services_ New Features and Updates.pptx
Get Started with ReactJS 18 Development Services_ New Features and Updates.pptxGet Started with ReactJS 18 Development Services_ New Features and Updates.pptx
Get Started with ReactJS 18 Development Services_ New Features and Updates.pptxConcetto Labs
 
Web Devlopment ppt.pptx
Web Devlopment ppt.pptxWeb Devlopment ppt.pptx
Web Devlopment ppt.pptxAartiVerma64
 
React js - The Core Concepts
React js - The Core ConceptsReact js - The Core Concepts
React js - The Core ConceptsDivyang Bhambhani
 

What's hot (20)

The redux saga begins
The redux saga beginsThe redux saga begins
The redux saga begins
 
Its time to React.js
Its time to React.jsIts time to React.js
Its time to React.js
 
Introduction to react_js
Introduction to react_jsIntroduction to react_js
Introduction to react_js
 
React event
React eventReact event
React event
 
React hooks
React hooksReact hooks
React hooks
 
Redux toolkit
Redux toolkitRedux toolkit
Redux toolkit
 
Git with t for teams
Git with t for teamsGit with t for teams
Git with t for teams
 
An introduction to React.js
An introduction to React.jsAn introduction to React.js
An introduction to React.js
 
Flutter Tutorial For Beginners | Edureka
Flutter Tutorial For Beginners | EdurekaFlutter Tutorial For Beginners | Edureka
Flutter Tutorial For Beginners | Edureka
 
Jetpack Compose.pptx
Jetpack Compose.pptxJetpack Compose.pptx
Jetpack Compose.pptx
 
Redux Sagas - React Alicante
Redux Sagas - React AlicanteRedux Sagas - React Alicante
Redux Sagas - React Alicante
 
Introduction to Redux
Introduction to ReduxIntroduction to Redux
Introduction to Redux
 
React + Redux Introduction
React + Redux IntroductionReact + Redux Introduction
React + Redux Introduction
 
React js
React jsReact js
React js
 
React js
React jsReact js
React js
 
reactJS
reactJSreactJS
reactJS
 
Get Started with ReactJS 18 Development Services_ New Features and Updates.pptx
Get Started with ReactJS 18 Development Services_ New Features and Updates.pptxGet Started with ReactJS 18 Development Services_ New Features and Updates.pptx
Get Started with ReactJS 18 Development Services_ New Features and Updates.pptx
 
Web Devlopment ppt.pptx
Web Devlopment ppt.pptxWeb Devlopment ppt.pptx
Web Devlopment ppt.pptx
 
React js - The Core Concepts
React js - The Core ConceptsReact js - The Core Concepts
React js - The Core Concepts
 
Portainer
PortainerPortainer
Portainer
 

Similar to Design for succcess with react and storybook.js

Adopting 3D Touch in your apps
Adopting 3D Touch in your appsAdopting 3D Touch in your apps
Adopting 3D Touch in your appsJuan C Catalan
 
Crossing platforms with JavaScript & React
Crossing platforms with JavaScript & React Crossing platforms with JavaScript & React
Crossing platforms with JavaScript & React Robert DeLuca
 
Academy PRO: React native - building first scenes
Academy PRO: React native - building first scenesAcademy PRO: React native - building first scenes
Academy PRO: React native - building first scenesBinary Studio
 
Android Design Patterns
Android Design PatternsAndroid Design Patterns
Android Design PatternsGodfrey Nolan
 
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)Ontico
 
What's New in Android
What's New in AndroidWhat's New in Android
What's New in AndroidRobert Cooper
 
Connect.js - Exploring React.Native
Connect.js - Exploring React.NativeConnect.js - Exploring React.Native
Connect.js - Exploring React.Nativejoshcjensen
 
Single Page Applications in Angular (italiano)
Single Page Applications in Angular (italiano)Single Page Applications in Angular (italiano)
Single Page Applications in Angular (italiano)Fabio Biondi
 
Reactive.architecture.with.Angular
Reactive.architecture.with.AngularReactive.architecture.with.Angular
Reactive.architecture.with.AngularEvan Schultz
 
React: JSX and Top Level API
React: JSX and Top Level APIReact: JSX and Top Level API
React: JSX and Top Level APIFabio Biondi
 
EclipseCon2011 Cross-Platform Mobile Development with Eclipse
EclipseCon2011 Cross-Platform Mobile Development with EclipseEclipseCon2011 Cross-Platform Mobile Development with Eclipse
EclipseCon2011 Cross-Platform Mobile Development with EclipseHeiko Behrens
 
Getting the Most Out of jQuery Widgets
Getting the Most Out of jQuery WidgetsGetting the Most Out of jQuery Widgets
Getting the Most Out of jQuery Widgetsvelveeta_512
 
Hidden Docs in Angular
Hidden Docs in AngularHidden Docs in Angular
Hidden Docs in AngularYadong Xie
 
AngularJS - Services
AngularJS - ServicesAngularJS - Services
AngularJS - ServicesNir Kaufman
 
Angular js 2.0, ng poznań 20.11
Angular js 2.0, ng poznań 20.11Angular js 2.0, ng poznań 20.11
Angular js 2.0, ng poznań 20.11Kamil Augustynowicz
 
Javascript And J Query
Javascript And J QueryJavascript And J Query
Javascript And J Queryitsarsalan
 

Similar to Design for succcess with react and storybook.js (20)

Android 3
Android 3Android 3
Android 3
 
Adopting 3D Touch in your apps
Adopting 3D Touch in your appsAdopting 3D Touch in your apps
Adopting 3D Touch in your apps
 
React redux
React reduxReact redux
React redux
 
Crossing platforms with JavaScript & React
Crossing platforms with JavaScript & React Crossing platforms with JavaScript & React
Crossing platforms with JavaScript & React
 
Academy PRO: React native - building first scenes
Academy PRO: React native - building first scenesAcademy PRO: React native - building first scenes
Academy PRO: React native - building first scenes
 
Android Design Patterns
Android Design PatternsAndroid Design Patterns
Android Design Patterns
 
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
 
What's New in Android
What's New in AndroidWhat's New in Android
What's New in Android
 
Connect.js - Exploring React.Native
Connect.js - Exploring React.NativeConnect.js - Exploring React.Native
Connect.js - Exploring React.Native
 
Single Page Applications in Angular (italiano)
Single Page Applications in Angular (italiano)Single Page Applications in Angular (italiano)
Single Page Applications in Angular (italiano)
 
Reactive.architecture.with.Angular
Reactive.architecture.with.AngularReactive.architecture.with.Angular
Reactive.architecture.with.Angular
 
shiny.pdf
shiny.pdfshiny.pdf
shiny.pdf
 
React: JSX and Top Level API
React: JSX and Top Level APIReact: JSX and Top Level API
React: JSX and Top Level API
 
EclipseCon2011 Cross-Platform Mobile Development with Eclipse
EclipseCon2011 Cross-Platform Mobile Development with EclipseEclipseCon2011 Cross-Platform Mobile Development with Eclipse
EclipseCon2011 Cross-Platform Mobile Development with Eclipse
 
Getting the Most Out of jQuery Widgets
Getting the Most Out of jQuery WidgetsGetting the Most Out of jQuery Widgets
Getting the Most Out of jQuery Widgets
 
Hidden Docs in Angular
Hidden Docs in AngularHidden Docs in Angular
Hidden Docs in Angular
 
AngularJS - Services
AngularJS - ServicesAngularJS - Services
AngularJS - Services
 
Angular js 2.0, ng poznań 20.11
Angular js 2.0, ng poznań 20.11Angular js 2.0, ng poznań 20.11
Angular js 2.0, ng poznań 20.11
 
Javascript And J Query
Javascript And J QueryJavascript And J Query
Javascript And J Query
 
React outbox
React outboxReact outbox
React outbox
 

Recently uploaded

High Profile Escorts Nerul WhatsApp +91-9930687706, Best Service
High Profile Escorts Nerul WhatsApp +91-9930687706, Best ServiceHigh Profile Escorts Nerul WhatsApp +91-9930687706, Best Service
High Profile Escorts Nerul WhatsApp +91-9930687706, Best Servicemeghakumariji156
 
一比一原版(ANU毕业证书)澳大利亚国立大学毕业证原件一模一样
一比一原版(ANU毕业证书)澳大利亚国立大学毕业证原件一模一样一比一原版(ANU毕业证书)澳大利亚国立大学毕业证原件一模一样
一比一原版(ANU毕业证书)澳大利亚国立大学毕业证原件一模一样yhavx
 
Top profile Call Girls In Mau [ 7014168258 ] Call Me For Genuine Models We ar...
Top profile Call Girls In Mau [ 7014168258 ] Call Me For Genuine Models We ar...Top profile Call Girls In Mau [ 7014168258 ] Call Me For Genuine Models We ar...
Top profile Call Girls In Mau [ 7014168258 ] Call Me For Genuine Models We ar...nirzagarg
 
NO1 Top Pakistani Amil Baba Real Amil baba In Pakistan Najoomi Baba in Pakist...
NO1 Top Pakistani Amil Baba Real Amil baba In Pakistan Najoomi Baba in Pakist...NO1 Top Pakistani Amil Baba Real Amil baba In Pakistan Najoomi Baba in Pakist...
NO1 Top Pakistani Amil Baba Real Amil baba In Pakistan Najoomi Baba in Pakist...Amil baba
 
怎样办理巴斯大学毕业证(Bath毕业证书)成绩单留信认证
怎样办理巴斯大学毕业证(Bath毕业证书)成绩单留信认证怎样办理巴斯大学毕业证(Bath毕业证书)成绩单留信认证
怎样办理巴斯大学毕业证(Bath毕业证书)成绩单留信认证eeanqy
 
Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...gajnagarg
 
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789CristineGraceAcuyan
 
How to Turn a Picture Into a Line Drawing in Photoshop
How to Turn a Picture Into a Line Drawing in PhotoshopHow to Turn a Picture Into a Line Drawing in Photoshop
How to Turn a Picture Into a Line Drawing in PhotoshopZenith Clipping
 
一比一定(购)西悉尼大学毕业证(WSU毕业证)成绩单学位证
一比一定(购)西悉尼大学毕业证(WSU毕业证)成绩单学位证一比一定(购)西悉尼大学毕业证(WSU毕业证)成绩单学位证
一比一定(购)西悉尼大学毕业证(WSU毕业证)成绩单学位证eqaqen
 
Furniture & Joinery Details_Designs.pptx
Furniture & Joinery Details_Designs.pptxFurniture & Joinery Details_Designs.pptx
Furniture & Joinery Details_Designs.pptxNikhil Raut
 
怎样办理伯明翰城市大学毕业证(BCU毕业证书)成绩单留信认证
怎样办理伯明翰城市大学毕业证(BCU毕业证书)成绩单留信认证怎样办理伯明翰城市大学毕业证(BCU毕业证书)成绩单留信认证
怎样办理伯明翰城市大学毕业证(BCU毕业证书)成绩单留信认证eeanqy
 
Minimalist Orange Portfolio by Slidesgo.pptx
Minimalist Orange Portfolio by Slidesgo.pptxMinimalist Orange Portfolio by Slidesgo.pptx
Minimalist Orange Portfolio by Slidesgo.pptxbalqisyamutia
 
Q4-W4-SCIENCE-5 power point presentation
Q4-W4-SCIENCE-5 power point presentationQ4-W4-SCIENCE-5 power point presentation
Q4-W4-SCIENCE-5 power point presentationZenSeloveres
 
一比一定(购)卡尔顿大学毕业证(CU毕业证)成绩单学位证
一比一定(购)卡尔顿大学毕业证(CU毕业证)成绩单学位证一比一定(购)卡尔顿大学毕业证(CU毕业证)成绩单学位证
一比一定(购)卡尔顿大学毕业证(CU毕业证)成绩单学位证wpkuukw
 
Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...gajnagarg
 
Top profile Call Girls In Sonipat [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In Sonipat [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In Sonipat [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In Sonipat [ 7014168258 ] Call Me For Genuine Models W...nirzagarg
 
Simple Conference Style Presentation by Slidesgo.pptx
Simple Conference Style Presentation by Slidesgo.pptxSimple Conference Style Presentation by Slidesgo.pptx
Simple Conference Style Presentation by Slidesgo.pptxbalqisyamutia
 
一比一定(购)滑铁卢大学毕业证(UW毕业证)成绩单学位证
一比一定(购)滑铁卢大学毕业证(UW毕业证)成绩单学位证一比一定(购)滑铁卢大学毕业证(UW毕业证)成绩单学位证
一比一定(购)滑铁卢大学毕业证(UW毕业证)成绩单学位证wpkuukw
 
Gamestore case study UI UX by Amgad Ibrahim
Gamestore case study UI UX by Amgad IbrahimGamestore case study UI UX by Amgad Ibrahim
Gamestore case study UI UX by Amgad Ibrahimamgadibrahim92
 
怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证
怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证
怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证ehyxf
 

Recently uploaded (20)

High Profile Escorts Nerul WhatsApp +91-9930687706, Best Service
High Profile Escorts Nerul WhatsApp +91-9930687706, Best ServiceHigh Profile Escorts Nerul WhatsApp +91-9930687706, Best Service
High Profile Escorts Nerul WhatsApp +91-9930687706, Best Service
 
一比一原版(ANU毕业证书)澳大利亚国立大学毕业证原件一模一样
一比一原版(ANU毕业证书)澳大利亚国立大学毕业证原件一模一样一比一原版(ANU毕业证书)澳大利亚国立大学毕业证原件一模一样
一比一原版(ANU毕业证书)澳大利亚国立大学毕业证原件一模一样
 
Top profile Call Girls In Mau [ 7014168258 ] Call Me For Genuine Models We ar...
Top profile Call Girls In Mau [ 7014168258 ] Call Me For Genuine Models We ar...Top profile Call Girls In Mau [ 7014168258 ] Call Me For Genuine Models We ar...
Top profile Call Girls In Mau [ 7014168258 ] Call Me For Genuine Models We ar...
 
NO1 Top Pakistani Amil Baba Real Amil baba In Pakistan Najoomi Baba in Pakist...
NO1 Top Pakistani Amil Baba Real Amil baba In Pakistan Najoomi Baba in Pakist...NO1 Top Pakistani Amil Baba Real Amil baba In Pakistan Najoomi Baba in Pakist...
NO1 Top Pakistani Amil Baba Real Amil baba In Pakistan Najoomi Baba in Pakist...
 
怎样办理巴斯大学毕业证(Bath毕业证书)成绩单留信认证
怎样办理巴斯大学毕业证(Bath毕业证书)成绩单留信认证怎样办理巴斯大学毕业证(Bath毕业证书)成绩单留信认证
怎样办理巴斯大学毕业证(Bath毕业证书)成绩单留信认证
 
Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...
 
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789
 
How to Turn a Picture Into a Line Drawing in Photoshop
How to Turn a Picture Into a Line Drawing in PhotoshopHow to Turn a Picture Into a Line Drawing in Photoshop
How to Turn a Picture Into a Line Drawing in Photoshop
 
一比一定(购)西悉尼大学毕业证(WSU毕业证)成绩单学位证
一比一定(购)西悉尼大学毕业证(WSU毕业证)成绩单学位证一比一定(购)西悉尼大学毕业证(WSU毕业证)成绩单学位证
一比一定(购)西悉尼大学毕业证(WSU毕业证)成绩单学位证
 
Furniture & Joinery Details_Designs.pptx
Furniture & Joinery Details_Designs.pptxFurniture & Joinery Details_Designs.pptx
Furniture & Joinery Details_Designs.pptx
 
怎样办理伯明翰城市大学毕业证(BCU毕业证书)成绩单留信认证
怎样办理伯明翰城市大学毕业证(BCU毕业证书)成绩单留信认证怎样办理伯明翰城市大学毕业证(BCU毕业证书)成绩单留信认证
怎样办理伯明翰城市大学毕业证(BCU毕业证书)成绩单留信认证
 
Minimalist Orange Portfolio by Slidesgo.pptx
Minimalist Orange Portfolio by Slidesgo.pptxMinimalist Orange Portfolio by Slidesgo.pptx
Minimalist Orange Portfolio by Slidesgo.pptx
 
Q4-W4-SCIENCE-5 power point presentation
Q4-W4-SCIENCE-5 power point presentationQ4-W4-SCIENCE-5 power point presentation
Q4-W4-SCIENCE-5 power point presentation
 
一比一定(购)卡尔顿大学毕业证(CU毕业证)成绩单学位证
一比一定(购)卡尔顿大学毕业证(CU毕业证)成绩单学位证一比一定(购)卡尔顿大学毕业证(CU毕业证)成绩单学位证
一比一定(购)卡尔顿大学毕业证(CU毕业证)成绩单学位证
 
Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...
 
Top profile Call Girls In Sonipat [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In Sonipat [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In Sonipat [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In Sonipat [ 7014168258 ] Call Me For Genuine Models W...
 
Simple Conference Style Presentation by Slidesgo.pptx
Simple Conference Style Presentation by Slidesgo.pptxSimple Conference Style Presentation by Slidesgo.pptx
Simple Conference Style Presentation by Slidesgo.pptx
 
一比一定(购)滑铁卢大学毕业证(UW毕业证)成绩单学位证
一比一定(购)滑铁卢大学毕业证(UW毕业证)成绩单学位证一比一定(购)滑铁卢大学毕业证(UW毕业证)成绩单学位证
一比一定(购)滑铁卢大学毕业证(UW毕业证)成绩单学位证
 
Gamestore case study UI UX by Amgad Ibrahim
Gamestore case study UI UX by Amgad IbrahimGamestore case study UI UX by Amgad Ibrahim
Gamestore case study UI UX by Amgad Ibrahim
 
怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证
怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证
怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证
 

Design for succcess with react and storybook.js

  • 1. DESIGN FORDESIGN FOR SUCCESSSUCCESS WITH REACT AND STORYBOOKSWITH REACT AND STORYBOOKS
  • 2. CHRIS SAYLORCHRIS SAYLOR LEAD ENGINEER @ ZUMBALEAD ENGINEER @ ZUMBA @cjsaylor
  • 3. DESIGN?DESIGN? THAT'S SOMEONE ELSES JOB.THAT'S SOMEONE ELSES JOB.
  • 4. Ugh, another sketch/photoshop slice job. Maybe, if I had been involved...
  • 5. WHY DO WE DO IT?WHY DO WE DO IT? No code involved, so designers can work completely independently Developers usually viewed as "bad" designers
  • 6. COMMON DESIGN WORKFLOWCOMMON DESIGN WORKFLOW = ?= ? Image source: @nicolesaidy
  • 7. HAVING DESIGNS DELIVERED:HAVING DESIGNS DELIVERED: Design elements tend to be "pages" and not components Can't easily show animations or responsive designs Version control? Some things may not be possible (or realistic) in a browser Still have a lot of work to "translate" to html ... and it may not be pixel perfect!
  • 8. WHY SHOULD WE CARE ABOUT DESIGN?WHY SHOULD WE CARE ABOUT DESIGN? Gateway for user acquisition Can reduce bugs So ware that isn't used is pointless
  • 9. WHY SHOULD WE CARE ABOUT DESIGN?WHY SHOULD WE CARE ABOUT DESIGN? Bad UX designs makes us susceptible to disruption.
  • 10. HOW DO WE BRIDGEHOW DO WE BRIDGE THE GAP?THE GAP?
  • 12.
  • 13. WHY STORYBOOK.JS?WHY STORYBOOK.JS? Integrates with React and Vue.js Immediate feedback of changes Easily see history of changes At the end of the design phase, we have functional components!
  • 15. Disclaimer: you'll need developer and designer buy-in
  • 16. KEEP DATA RETRIEVAL SEPARATEKEEP DATA RETRIEVAL SEPARATE Avoid state in your views as much as possible Compose your components as much as possible Use props to pass in data
  • 17. TYPICAL REACT TUTORIAL COMPONENTTYPICAL REACT TUTORIAL COMPONENT export default class ListComponent extends React.Component { state = { items: [] } async componentDidMount() { this.setState({ items: await fetch('/items') }); } renderItems() { return this.state.items.map(item => <li>{item}</li>) } render = () => ( <ul>{ this.renderItems() }</ul> ) }
  • 19. USE PROPS TO DISPLAYUSE PROPS TO DISPLAY export default class ListComponent extends React.Component { renderItems = () => { return (this.props.items || []) .map(item => <li>{item}</li>) } render = () => <ul>{ this.renderItems() }</ul> }
  • 20. PASS THE STATE DATA TO THE VIEWPASS THE STATE DATA TO THE VIEW import List from './list-component'; export default class ListContainer extends React.Component { state = { items: [] } async componentDidMount() { this.setState({ items: await fetch('/items') }); } render = () => <List items={this.state.items}/> }
  • 22. import { storiesOf } from '@storybook/react'; import List from './list-component'; storiesOf('List', module) .add('No items', () => <List />) .add('One item', () => <List items={['item 1']} />) .add('Multiple items', () => { return <List items={['item 1', 'item 2', 'item 3']} /> });
  • 23.
  • 24.
  • 25.
  • 26. STORYBOOK CAPABILITIESSTORYBOOK CAPABILITIES Show when user actions occur in the view
  • 27.
  • 28. ADD A CLICK ACTIONADD A CLICK ACTION export default class ListComponent extends React.Component { onClick = (e) => { this.props.onItemClicked(e.target.innerText); } renderItems = () => { return (this.props.items || []) .map(item => ( <li onClick={this.onClick}>{item}</li> )); } render = () => <ul>{ this.renderItems() }</ul> }
  • 29. MODIFY OUR STORY FOR THE ACTIONMODIFY OUR STORY FOR THE ACTION import { storiesOf, action } from '@storybook/react'; import List from './list-component'; storiesOf('List', module) .add('Multiple items', () => { return ( <List onItemClicked={action('Item clicked!')} items={['item 1', 'item 2', 'item 3']} /> ); });
  • 31.
  • 32. ADD THE "KNOBS" ADDONADD THE "KNOBS" ADDON This is what is responsible for showing the panel // addons.js import '@storybook/addon-knobs/register';
  • 33. MODIFY THE STORYMODIFY THE STORY import { storiesOf, action } from '@storybook/react'; import List from './list-component'; import {withKnobs, array} from '@storybook/addon-knobs'; storiesOf('List', module) .addDecorator(withKnobs) .add('Multiple items', () => ( <List onItemClicked={action('Item clicked!')} items={ array('Items', [ 'item 1', 'item 2', 'item 3' ]) } /> ));
  • 35.
  • 36. CONCLUSIONCONCLUSION Getting involved in the design process doesn't have to be scary Start fresh or add to existing React/VueJS app Hit the ground running when designs are finished Version control designs and their stories
  • 39.
  • 41. REMEMBER THIS?REMEMBER THIS? import List from './list-component'; export default class ListContainer extends React.Component { state = { items: [] } async componentDidMount() { this.setState({ items: await fetch('/items') }); } render = () => <List items={this.state.items}/> }
  • 42. REACT DOM & NATIVE...TOGETHER?REACT DOM & NATIVE...TOGETHER?
  • 43. HIGHER-ORDER COMPONENT (HOC)HIGHER-ORDER COMPONENT (HOC) Reference: https://reactjs.org/docs/higher-order- components.html
  • 44. export default function withListData(WrappableComponent) { return class extends React.Component { state = { items: [] } async componentDidMount() { this.setState({ items: await fetch('/items') }); } render = () => ( <WrappableComponent items={this.state.items}/> ) } }
  • 45. USING THE NEW HOC IN REACT NATIVEUSING THE NEW HOC IN REACT NATIVE import List from './native/list-component'; import withListData from 'list-container'; export default class SomeReactView extends React.Component { componentDidMount() { this.wrappedList = withListData(<List/>); } render() { if (!this.wrappedList) { return null; } const WrappedList = this.wrappedList; return <WrappedList/>; } }