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

Angular Advanced Routing
Angular Advanced RoutingAngular Advanced Routing
Angular Advanced RoutingLaurent Duveau
 
Angular Routing Guard
Angular Routing GuardAngular Routing Guard
Angular Routing GuardKnoldus Inc.
 
Docker Registry V2
Docker Registry V2Docker Registry V2
Docker Registry V2Docker, Inc.
 
Software Design Patterns in Laravel by Phill Sparks
Software Design Patterns in Laravel by Phill SparksSoftware Design Patterns in Laravel by Phill Sparks
Software Design Patterns in Laravel by Phill SparksPhill Sparks
 
Nest.js Introduction
Nest.js IntroductionNest.js Introduction
Nest.js IntroductionTakuya Tejima
 
Developing New Widgets for your Views in Owl
Developing New Widgets for your Views in OwlDeveloping New Widgets for your Views in Owl
Developing New Widgets for your Views in OwlOdoo
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentationJohn Lynch
 
Angular Data Binding
Angular Data BindingAngular Data Binding
Angular Data BindingDuy Khanh
 
Redux Sagas - React Alicante
Redux Sagas - React AlicanteRedux Sagas - React Alicante
Redux Sagas - React AlicanteIgnacio Martín
 
Introduction to RxJS
Introduction to RxJSIntroduction to RxJS
Introduction to RxJSBrainhub
 
Oracle APEX Performance
Oracle APEX PerformanceOracle APEX Performance
Oracle APEX PerformanceScott Wesley
 
What’s wrong with WebSocket APIs? Unveiling vulnerabilities in WebSocket APIs.
What’s wrong with WebSocket APIs? Unveiling vulnerabilities in WebSocket APIs.What’s wrong with WebSocket APIs? Unveiling vulnerabilities in WebSocket APIs.
What’s wrong with WebSocket APIs? Unveiling vulnerabilities in WebSocket APIs.Mikhail Egorov
 
Introduction to React JS
Introduction to React JSIntroduction to React JS
Introduction to React JSArno Lordkronos
 
The Functional Programmer's Toolkit (NDC London 2019)
The Functional Programmer's Toolkit (NDC London 2019)The Functional Programmer's Toolkit (NDC London 2019)
The Functional Programmer's Toolkit (NDC London 2019)Scott Wlaschin
 
Rethinking Best Practices
Rethinking Best PracticesRethinking Best Practices
Rethinking Best Practicesfloydophone
 

What's hot (20)

Angular Advanced Routing
Angular Advanced RoutingAngular Advanced Routing
Angular Advanced Routing
 
Workshop 21: React Router
Workshop 21: React RouterWorkshop 21: React Router
Workshop 21: React Router
 
PHP Security
PHP SecurityPHP Security
PHP Security
 
HTTP Security Headers
HTTP Security HeadersHTTP Security Headers
HTTP Security Headers
 
Angular Routing Guard
Angular Routing GuardAngular Routing Guard
Angular Routing Guard
 
Angular modules in depth
Angular modules in depthAngular modules in depth
Angular modules in depth
 
Docker Registry V2
Docker Registry V2Docker Registry V2
Docker Registry V2
 
Software Design Patterns in Laravel by Phill Sparks
Software Design Patterns in Laravel by Phill SparksSoftware Design Patterns in Laravel by Phill Sparks
Software Design Patterns in Laravel by Phill Sparks
 
Nest.js Introduction
Nest.js IntroductionNest.js Introduction
Nest.js Introduction
 
Developing New Widgets for your Views in Owl
Developing New Widgets for your Views in OwlDeveloping New Widgets for your Views in Owl
Developing New Widgets for your Views in Owl
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Angular Data Binding
Angular Data BindingAngular Data Binding
Angular Data Binding
 
Redux Sagas - React Alicante
Redux Sagas - React AlicanteRedux Sagas - React Alicante
Redux Sagas - React Alicante
 
Introduction to RxJS
Introduction to RxJSIntroduction to RxJS
Introduction to RxJS
 
API for Beginners
API for BeginnersAPI for Beginners
API for Beginners
 
Oracle APEX Performance
Oracle APEX PerformanceOracle APEX Performance
Oracle APEX Performance
 
What’s wrong with WebSocket APIs? Unveiling vulnerabilities in WebSocket APIs.
What’s wrong with WebSocket APIs? Unveiling vulnerabilities in WebSocket APIs.What’s wrong with WebSocket APIs? Unveiling vulnerabilities in WebSocket APIs.
What’s wrong with WebSocket APIs? Unveiling vulnerabilities in WebSocket APIs.
 
Introduction to React JS
Introduction to React JSIntroduction to React JS
Introduction to React JS
 
The Functional Programmer's Toolkit (NDC London 2019)
The Functional Programmer's Toolkit (NDC London 2019)The Functional Programmer's Toolkit (NDC London 2019)
The Functional Programmer's Toolkit (NDC London 2019)
 
Rethinking Best Practices
Rethinking Best PracticesRethinking Best Practices
Rethinking Best Practices
 

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

Design Inspiration for College by Slidesgo.pptx
Design Inspiration for College by Slidesgo.pptxDesign Inspiration for College by Slidesgo.pptx
Design Inspiration for College by Slidesgo.pptxTusharBahuguna2
 
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)amitlee9823
 
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779Delhi Call girls
 
SD_The MATATAG Curriculum Training Design.pptx
SD_The MATATAG Curriculum Training Design.pptxSD_The MATATAG Curriculum Training Design.pptx
SD_The MATATAG Curriculum Training Design.pptxjanettecruzeiro1
 
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779Best VIP Call Girls Noida Sector 44 Call Me: 8448380779
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779Delhi Call girls
 
VVIP CALL GIRLS Lucknow 💓 Lucknow < Renuka Sharma > 7877925207 Escorts Service
VVIP CALL GIRLS Lucknow 💓 Lucknow < Renuka Sharma > 7877925207 Escorts ServiceVVIP CALL GIRLS Lucknow 💓 Lucknow < Renuka Sharma > 7877925207 Escorts Service
VVIP CALL GIRLS Lucknow 💓 Lucknow < Renuka Sharma > 7877925207 Escorts Servicearoranaina404
 
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...amitlee9823
 
Chapter 19_DDA_TOD Policy_First Draft 2012.pdf
Chapter 19_DDA_TOD Policy_First Draft 2012.pdfChapter 19_DDA_TOD Policy_First Draft 2012.pdf
Chapter 19_DDA_TOD Policy_First Draft 2012.pdfParomita Roy
 
Case Study of Hotel Taj Vivanta, Pune
Case Study of Hotel Taj Vivanta, PuneCase Study of Hotel Taj Vivanta, Pune
Case Study of Hotel Taj Vivanta, PuneLukeKholes
 
call girls in Dakshinpuri (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
call girls in Dakshinpuri  (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️call girls in Dakshinpuri  (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
call girls in Dakshinpuri (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...Delhi Call girls
 
AMBER GRAIN EMBROIDERY | Growing folklore elements | Root-based materials, w...
AMBER GRAIN EMBROIDERY | Growing folklore elements |  Root-based materials, w...AMBER GRAIN EMBROIDERY | Growing folklore elements |  Root-based materials, w...
AMBER GRAIN EMBROIDERY | Growing folklore elements | Root-based materials, w...BarusRa
 
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...Pooja Nehwal
 
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...amitlee9823
 
Top Rated Pune Call Girls Saswad ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated  Pune Call Girls Saswad ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Top Rated  Pune Call Girls Saswad ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated Pune Call Girls Saswad ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Call Girls in Nagpur High Profile
 
Verified Trusted Call Girls Adugodi💘 9352852248 Good Looking standard Profil...
Verified Trusted Call Girls Adugodi💘 9352852248  Good Looking standard Profil...Verified Trusted Call Girls Adugodi💘 9352852248  Good Looking standard Profil...
Verified Trusted Call Girls Adugodi💘 9352852248 Good Looking standard Profil...kumaririma588
 
Tapestry Clothing Brands: Collapsing the Funnel
Tapestry Clothing Brands: Collapsing the FunnelTapestry Clothing Brands: Collapsing the Funnel
Tapestry Clothing Brands: Collapsing the Funneljen_giacalone
 

Recently uploaded (20)

Design Inspiration for College by Slidesgo.pptx
Design Inspiration for College by Slidesgo.pptxDesign Inspiration for College by Slidesgo.pptx
Design Inspiration for College by Slidesgo.pptx
 
B. Smith. (Architectural Portfolio.).pdf
B. Smith. (Architectural Portfolio.).pdfB. Smith. (Architectural Portfolio.).pdf
B. Smith. (Architectural Portfolio.).pdf
 
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
Escorts Service Nagavara ☎ 7737669865☎ Book Your One night Stand (Bangalore)
 
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
 
SD_The MATATAG Curriculum Training Design.pptx
SD_The MATATAG Curriculum Training Design.pptxSD_The MATATAG Curriculum Training Design.pptx
SD_The MATATAG Curriculum Training Design.pptx
 
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779Best VIP Call Girls Noida Sector 44 Call Me: 8448380779
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779
 
VVIP CALL GIRLS Lucknow 💓 Lucknow < Renuka Sharma > 7877925207 Escorts Service
VVIP CALL GIRLS Lucknow 💓 Lucknow < Renuka Sharma > 7877925207 Escorts ServiceVVIP CALL GIRLS Lucknow 💓 Lucknow < Renuka Sharma > 7877925207 Escorts Service
VVIP CALL GIRLS Lucknow 💓 Lucknow < Renuka Sharma > 7877925207 Escorts Service
 
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
RT Nagar Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Bang...
 
young call girls in Pandav nagar 🔝 9953056974 🔝 Delhi escort Service
young call girls in Pandav nagar 🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Pandav nagar 🔝 9953056974 🔝 Delhi escort Service
young call girls in Pandav nagar 🔝 9953056974 🔝 Delhi escort Service
 
Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance VVIP 🍎 SER...
Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance  VVIP 🍎 SER...Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance  VVIP 🍎 SER...
Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance VVIP 🍎 SER...
 
Chapter 19_DDA_TOD Policy_First Draft 2012.pdf
Chapter 19_DDA_TOD Policy_First Draft 2012.pdfChapter 19_DDA_TOD Policy_First Draft 2012.pdf
Chapter 19_DDA_TOD Policy_First Draft 2012.pdf
 
Case Study of Hotel Taj Vivanta, Pune
Case Study of Hotel Taj Vivanta, PuneCase Study of Hotel Taj Vivanta, Pune
Case Study of Hotel Taj Vivanta, Pune
 
call girls in Dakshinpuri (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
call girls in Dakshinpuri  (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️call girls in Dakshinpuri  (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
call girls in Dakshinpuri (DELHI) 🔝 >༒9953056974 🔝 genuine Escort Service 🔝✔️✔️
 
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
call girls in Kaushambi (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
 
AMBER GRAIN EMBROIDERY | Growing folklore elements | Root-based materials, w...
AMBER GRAIN EMBROIDERY | Growing folklore elements |  Root-based materials, w...AMBER GRAIN EMBROIDERY | Growing folklore elements |  Root-based materials, w...
AMBER GRAIN EMBROIDERY | Growing folklore elements | Root-based materials, w...
 
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...
 
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Brookefield Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 
Top Rated Pune Call Girls Saswad ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated  Pune Call Girls Saswad ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Top Rated  Pune Call Girls Saswad ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated Pune Call Girls Saswad ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
 
Verified Trusted Call Girls Adugodi💘 9352852248 Good Looking standard Profil...
Verified Trusted Call Girls Adugodi💘 9352852248  Good Looking standard Profil...Verified Trusted Call Girls Adugodi💘 9352852248  Good Looking standard Profil...
Verified Trusted Call Girls Adugodi💘 9352852248 Good Looking standard Profil...
 
Tapestry Clothing Brands: Collapsing the Funnel
Tapestry Clothing Brands: Collapsing the FunnelTapestry Clothing Brands: Collapsing the Funnel
Tapestry Clothing Brands: Collapsing the Funnel
 

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/>; } }