Responsive App Design with the Salesforce Lightning Design System

29
Responsive App Design with the Lightning Design System

Transcript of Responsive App Design with the Salesforce Lightning Design System

Page 1: Responsive App Design with the Salesforce Lightning Design System

Responsive App Design with the Lightning Design

System

Page 2: Responsive App Design with the Salesforce Lightning Design System

Keir Bowden

CTO, BrightGen

@bob_buzzard

+ 9

x 5

Page 3: Responsive App Design with the Salesforce Lightning Design System

Demo App

Page 4: Responsive App Design with the Salesforce Lightning Design System

Agenda

• What

• Why

• How

• Lightning Design System

• Images

• Demo

Page 5: Responsive App Design with the Salesforce Lightning Design System

What is Responsive

Design• Apps respond to device

• Viewport size

• Orientation

• Named by Ethan Marcotte

• http://bobbuzz.me.uk/1hI879K

Page 6: Responsive App Design with the Salesforce Lightning Design System

What is Responsive

Design

Page 7: Responsive App Design with the Salesforce Lightning Design System

Agenda

• What

• Why

• How

• Lightning Design System

• Images

• Demo

Page 8: Responsive App Design with the Salesforce Lightning Design System

Why use Responsive

Design?• One app to rule them all

• One URL

• One content source

• Single view of users

• Google’s recommended design

pattern

• Easier to crawl

• Better for the link algorithm

http://bobbuzz.me.uk/1g7G3wV

Page 9: Responsive App Design with the Salesforce Lightning Design System

Agenda

• What

• Why

• How

• Lightning Design System

• Images

• Demo

Page 10: Responsive App Design with the Salesforce Lightning Design System

Cornerstone #1 – Viewport

Meta Tag• Viewport meta tag

• width=device-width• Report actual size of device

• initial-scale=1.0• Display page actual size

Page 11: Responsive App Design with the Salesforce Lightning Design System

Cornerstone #2 – Fluid Grid

Page 12: Responsive App Design with the Salesforce Lightning Design System

Reflow

1 2 3 4 5 6 7 8 9 10 11 12

1 2 3 4 5 6 7 8 9 10 11 12

1 2 3 4 5 6

7 8 9 10 11 123

1

2

Page 13: Responsive App Design with the Salesforce Lightning Design System

Cornerstone #3 – CSS Media

Queries• Expression limiting scope of CSS

Page 14: Responsive App Design with the Salesforce Lightning Design System

Agenda

• What

• Why

• How

• Lightning Design System

• Images

• Demo

Page 15: Responsive App Design with the Salesforce Lightning Design System

Lightning Design

System• Design patterns, components and

guidelines

• Mobile first

• Lightning, Visualforce or off-platform

• Consistent styling with Salesforce

• No JavaScript

• Namespaced CSS

• Latest browser versions required

Page 16: Responsive App Design with the Salesforce Lightning Design System

Responsive

Framework• Fluid grid

• 1 thru 8, and 12 columns

• Column spanning styles• slds-large-size--3-of-4

• slds-medium-size--1-of-2

• 4 CSS Breakpoints• x-small 320px+

• small – 480px+

• medium – 768px+

• large – 1024px+

Page 17: Responsive App Design with the Salesforce Lightning Design System

Agenda

• What

• Why

• How

• Lightning Design System

• Images

• Demo

Page 18: Responsive App Design with the Salesforce Lightning Design System

Image Challenges

• 62% of the web is images

• Traditionally fixed size

• Options:

• Blurred pages for some

• Slow pages for everyone

• Download and shrink

• Original size 500x500 = 250k

• Resize for tablet 250x250 = 62.5k –

75% wasted

• Resize for tablet 125x125 = 15.6k –

93% wasted

✔✖

Page 19: Responsive App Design with the Salesforce Lightning Design System

Fluid-Width Images

• New attributes for img element• srcset – image options and widths

• sizes – media query and desired width

• Browser chooses appropriate image

Page 20: Responsive App Design with the Salesforce Lightning Design System

Art Direction

• Don’t always want to shrink

Page 21: Responsive App Design with the Salesforce Lightning Design System

Picture Element

Page 22: Responsive App Design with the Salesforce Lightning Design System

Picture Element

• Not supported by lightning components (Spring 16)

• Generate the HTML elements through a component

renderer

• ‘Picture’ component in demo app

Page 23: Responsive App Design with the Salesforce Lightning Design System

Agenda

• What

• Why

• How

• Lightning Design System

• Images

• Demo

Page 24: Responsive App Design with the Salesforce Lightning Design System

Demo

• Blog home page

• Built on Lightning Design System

• Recent posts

• Comments

• Search

• Github :

• bobbuzz.me.uk/SFTW16RWD

Page 25: Responsive App Design with the Salesforce Lightning Design System

Code

Post

Post

Post

About

Search

1

Post

Post

Post

3

Search

About

1

Page 26: Responsive App Design with the Salesforce Lightning Design System

Code

Page 27: Responsive App Design with the Salesforce Lightning Design System

Code

Page 28: Responsive App Design with the Salesforce Lightning Design System

Recap

• Viewport meta tag

• Responsive grid

• CSS breakpoints

• Responsive images

Page 29: Responsive App Design with the Salesforce Lightning Design System

Questions?

BrightGen

Stand 114

Cloud Expo