Slide 1

Slide 1 text

Engineering a Design System

Slide 2

Slide 2 text

Design systems Style guide?
 Component library?
 UI toolkit? }close enough

Slide 3

Slide 3 text

Make designers and developers more produc

Slide 4

Slide 4 text

h"ps://www.telus.com | Design System

Slide 5

Slide 5 text

| Design System React Sketch

Slide 6

Slide 6 text

Engineering for stability by crea(ng inten(onal APIs and
 tes(ng first and o5en. Engineering for scale ↔ by automa(ng documenta(on and op(mizing package distribu(on.

Slide 7

Slide 7 text


 // Button.scss .button { padding: 1rem; border-radius: 4px; color: white; } .button--primary { background-color: $color-primary; } .button--secondary { background-color: $color-secondary; } 
 Shop now Learn more class Button extends React.Component { render() { // a branded HTML button } } Design system Applica8on Output

Slide 8

Slide 8 text


 // Button.scss .button { padding: 1rem; border-radius: 4px; color: white; } .button--primary { background-color: $color-primary; } .button--secondary { background-color: $color-secondary; } 
 // MySquareButton.scss 
 .button { border-radius: 0; color: black; } .my-square-button { background-color: hotpink; } 
 Find a store class Button extends React.Component { render() { // a branded HTML button } } Design system Applica8on 
 // Button.scss .button { padding: 1rem; border-radius: 4px; color: white; } .button--primary { background-color: $color-primary; } .button--secondary { background-color: $color-secondary; } Output

Slide 9

Slide 9 text

h"ps://github.com/css-modules/css-modules

Slide 10

Slide 10 text

// Button.scss .button { // core button styles } .primary { composes: button; background-color: $color-primary; } .secondary { composes: button; background-color: $color-secondary; } import styles from './Button.scss' class Button extends React.Component { render() { return ( {this.props.children} ) } }

Slide 11

Slide 11 text

// Button.scss .button { // core button styles } .primary { composes: button; background-color: $color-primary; } .secondary { composes: button; background-color: $color-secondary; } import styles from './Button.scss' class Button extends React.Component { render() { return ( {this.props.children} ) } } // compiled Button.css .TDS_Button__button___2kyCB { ... } 
 .TDS_Button__primary___3Xb72 { ... } .TDS_Button__secondary___2qhCP { ... }

Slide 12

Slide 12 text


 Shop now Learn more

Slide 13

Slide 13 text

Accessibility Tes8ng

Slide 14

Slide 14 text


 $ yarn test:e2e @tds/core-button yarn run v1.5.1 $ node scripts/e2e.js Started chromedriver [Components Spec] Test Suite ================================ Running: @tds/core-button ✔ Element <#button> was visible after 31 milliseconds. ✔ Passed [ok]: 9 aXe Tests Passed ✖ Failed [fail]: (Elements must have sufficient color contrast [
Submit
]) - expected "https:// dequeuniversity.com/rules/axe/2.6/color-contrast?application=axeAPI" but got: "policy violation" at endReadableNT (_stream_readable.js:1101:12) ✖ #app passes accessibility scan - expected "true" but got: "false" at Object.checkAccessibility (/Users/ryanoglesby/Projects/telus-digital/tds/ e2e/commands/checkAccessibility.js:4:35) FAILED: 2 assertions failed and 2 passed (1.145s)


Slide 15

Slide 15 text

h"ps://dequeuniversity.com/rules/axe/2.6/color-contrast

Slide 16

Slide 16 text

Accessibility Tes8ng h"p://nightwatchjs.org h"ps://github.com/ahmadnassri/nightwatch-accessibility

Slide 17

Slide 17 text

Visual Regression Tes8ng

Slide 18

Slide 18 text

$ yarn test:e2e @tds/core-notification yarn run v1.5.1 $ node scripts/e2e.js Started chromedriver [Components Spec] Test Suite ================================ Running: @tds/core-notification ✖ Screenshots Match Failed for chrome_headless.png with a tolerance of 0%, actual was 1.07%. - expected "0" but got: "1.07" at Object.takeScreenshot (/Users/ryanoglesby/Projects/telus-digital/tds/e2e/ commands/compareScreenshot.js:55:17) at Object.browser.saveScreenshot (/Users/ryanoglesby/Projects/telus-digital/ tds/e2e/commands/compareScreenshot.js:38:16) at FSReqWrap.oncomplete (fs.js:153:20) FAILED: 1 assertions failed and 3 passed (3.314s) _________________________________________________ TEST FAILURE: 1 assertions failed, 3 passed. (3.378s)

Slide 19

Slide 19 text

Visual Regression Tes8ng

Slide 20

Slide 20 text

Visual Regression Tes8ng

Slide 21

Slide 21 text

Visual Regression Tes8ng

Slide 22

Slide 22 text

Visual Regression Tes8ng h"ps://github.com/HuddleEng/Resemble.js

Slide 23

Slide 23 text

Engineering for stability by crea(ng inten(onal APIs and
 tes(ng first and o5en. Engineering for scale ↔ by automa(ng documenta(on and op(mizing package distribu(on.

Slide 24

Slide 24 text

• Correct and trustworthy • Comprehensive • Component APIs (props, data types, allowed values) • Live examples Documenta8on must-haves React Styleguidist Storybook

Slide 25

Slide 25 text

/** * A standard, branded clickable element for use in forms mainly. * @version 1.0.2 */ class Button extends React.Component { render() { // ... } } Button.propTypes = { /** * The HTML button type. * @see See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/ Element/button) for more info. */ type: PropTypes.oneOf(['button', 'submit', 'reset']), /** * The style. */ variant: PropTypes.oneOf(['primary', 'secondary', 'inverted']), /** * The label. */ children: PropTypes.string.isRequired, } Button.defaultProps = { type: 'button', variant: 'primary', }

Slide 26

Slide 26 text

Provide a function as the `onClick` prop to perform an action when clicked. **Avoid using a button if navigation is the primary action, as a [Link](#link) is more appropriate.** ### Best practices * Aim to use only one primary button per page * Keep the label short and able to fit on a single line * The label should clearly describe the action By default, Buttons will be displayed in the `primary` variant. Use primary buttons for the main action on a page or in a form. ``` Submit ``` Specify the `variant` to create a button for secondary actions. ``` Find out more ```

Slide 27

Slide 27 text

h"ps://tds.telus.com/components/index.html

Slide 28

Slide 28 text

h"ps://www.npmjs.com/package/@telusdigital/tds

Slide 29

Slide 29 text

import { Button } from '@telusdigital/tds' import '@telusdigital/tds/dist/index.css' class HelloWorldApp extends React.Component { render() { return ( Hello world ); } } export default HelloWorldApp 
 { "name": "@telusdigital/hello-world-app", "version": “0.1.0", "description": "An app that says hello", "dependencies": { "@telusdigital/tds": "^1.0.0" } }

Slide 30

Slide 30 text

import { Button } from '@telusdigital/tds' import '@telusdigital/tds/dist/index.css' class HelloWorldApp extends React.Component { render() { return ( Hello world ); } } export default HelloWorldApp 
 { "name": "@telusdigital/hello-world-app", "version": “0.1.0", "description": "An app that says hello", "dependencies": { "@telusdigital/tds": "^1.0.0" } } “^2.0.0" .TDS_Button__primary___3Xb72 { /* ... */ } .TDS_Button__secondary___2qhCP { /* ... */ } .TDS_Text__base___2nt0g { /* ... */ } .TDS_Box__spacing2___3Z6ro { /* ... */ }

Slide 31

Slide 31 text

@tds/box @tds/buDon @tds/buDon-link @tds/card @tds/checkbox @tds/chevron-link @tds/colours @tds/css-reset @tds/decora8ve-icon h"ps://lernajs.io

Slide 32

Slide 32 text

h"ps://www.npmjs.com/org/tds

Slide 33

Slide 33 text

• Consolidate the lint, build, test, and release process • Easier to coordinate changes across mul

Slide 34

Slide 34 text

import Box from '@tds/core-box' import Button from '@tds/core-button' class HelloWorldApp extends React.Component { render() { return ( Hello world ); } } export default HelloWorldApp 
 { "name": "@telusdigital/hello-world-app", "version": “0.1.0", "description": "An app that says hello", "dependencies": { “@tds/core-box": “^1.0.2”, “@tds/core-button": "^1.1.0" } }

Slide 35

Slide 35 text

h"ps://tds.telus.com h"ps://github.com/telus/tds-core It’s open source

Slide 36

Slide 36 text

React CSS Modules ✅ jest + enzyme + enzyme-matchers nightwatch + nightwatch-accessibility (axe-core) resemble-js react-styleguidist lerna Key technology

Slide 37

Slide 37 text

Ryan Oglesby @ryanoglesby08 hOps:/ /ryanogles.by Engineering a Design System