A "content-first" approach to designing responsive Drupal layouts ...

76
A "content-first" approach to designing responsive Drupal layouts using Twitter Bootstrap Megan Miller & Brian Young Stanford University BAD Camp 2012 — November 4, 2012

Transcript of A "content-first" approach to designing responsive Drupal layouts ...

Page 1: A "content-first" approach to designing responsive Drupal layouts ...

A "content-first" approach to designing responsive Drupal

layouts using Twitter Bootstrap Megan Miller & Brian Young

Stanford University

BAD Camp 2012 — November 4, 2012

Page 2: A "content-first" approach to designing responsive Drupal layouts ...

Brian Young Web Designer & Developer

Documentation, Design, & Development Stanford University

@auracreations [email protected]

Megan Miller Web Designer

Stanford Web Services Stanford University @meganerinmiller

[email protected]

Page 3: A "content-first" approach to designing responsive Drupal layouts ...

Back in the day...

Page 4: A "content-first" approach to designing responsive Drupal layouts ...

But now...

Source: http://mobiforge.com/developing/story/device-diversity and http://jquerymobile.com

an explosion of devices!

Page 5: A "content-first" approach to designing responsive Drupal layouts ...

Device diversity

We can't predict the device of the future.

How can we know what size of device we are designing for?

Page 6: A "content-first" approach to designing responsive Drupal layouts ...

"Mobile" Trends

35% of American adults own a smartphone

25% of smartphone users say they only use their phone to browse the web Source: Pew Internet & American Life Project – http://www.pewinternet.org/Reports/2011/Smartphones.aspx

Page 7: A "content-first" approach to designing responsive Drupal layouts ...

In an ideal world...

A custom experience for every device.

Page 8: A "content-first" approach to designing responsive Drupal layouts ...

We go responsive.

same content reused for each screen size

Sparkbox website at different browser sizes (from http://mediaqueri.es)

Page 9: A "content-first" approach to designing responsive Drupal layouts ...

A typical department at Stanford

Small staff & limited resources

Page 10: A "content-first" approach to designing responsive Drupal layouts ...

Centralized Tools and Resources

Page 11: A "content-first" approach to designing responsive Drupal layouts ...

We want to make it easy.

Page 12: A "content-first" approach to designing responsive Drupal layouts ...

What is Responsive Web Design? (RWD)

Page 13: A "content-first" approach to designing responsive Drupal layouts ...

"Responsive"

A design that responds to the size of the browser or device.

Let's take a look at an example…

Microso# website at different browser sizes (from http://mediaqueri.es)

Page 14: A "content-first" approach to designing responsive Drupal layouts ...

"Design"

We mostly mean layout when referring to "design" in RWD.

Page 15: A "content-first" approach to designing responsive Drupal layouts ...

A single code base

Creating one website, and displaying it in different ways.

Atlanta Ballet website at different browser sizes (from http://mediaqueri.es)

Page 16: A "content-first" approach to designing responsive Drupal layouts ...

Embrace Flexibility

RWD is a philosophy and a practice.

By embracing the inherent flexibility of the web, we can design for the future.

Page 17: A "content-first" approach to designing responsive Drupal layouts ...

How do you implement Responsive Web Design?

Page 18: A "content-first" approach to designing responsive Drupal layouts ...

Flexible Grid-Based Layout

Flexible Images and Media

Media Queries

Page 19: A "content-first" approach to designing responsive Drupal layouts ...

Flexible Grid

Express your layout proportionally.

Be flexible — not pixel-perfect.

25% 50% 25%

Page 20: A "content-first" approach to designing responsive Drupal layouts ...

Flexible Media

Flexible containers constrain proportions of images and media by using width:100%;  

image fills width of container

Page 21: A "content-first" approach to designing responsive Drupal layouts ...

Media Queries

Detect your device screen width, then load different styles.

@media  screen  and  (max-­‐width:  480px)  {  .mything  {  

width:100%;  }  

}  @media  screen  and  (max-­‐width:  1200px)  {  

.mything  {  width:30%;  

}  }  

Page 22: A "content-first" approach to designing responsive Drupal layouts ...

Flexible Grid-Based Layout

Flexible Images and Media

Media Queries

Page 23: A "content-first" approach to designing responsive Drupal layouts ...

What should you consider when designing responsive websites?

Page 24: A "content-first" approach to designing responsive Drupal layouts ...

Responsive Layouts

Are about preserving content hierarchy

and legibility.

Page 25: A "content-first" approach to designing responsive Drupal layouts ...

Content Hierarchy

What content is most important?

Give it emphasis through size and order.

Page 26: A "content-first" approach to designing responsive Drupal layouts ...

Preserve Content Hierarchy

On small devices, what shows up first?

Page 27: A "content-first" approach to designing responsive Drupal layouts ...

Legibility

Legibility of text, but also "legibility" of micro-layouts.

Page 28: A "content-first" approach to designing responsive Drupal layouts ...

Preserve legibility

Don't let things get too squished or stretched!

normal squished

Page 29: A "content-first" approach to designing responsive Drupal layouts ...

Preserve legibility

A good solution:

normal image on top

Page 30: A "content-first" approach to designing responsive Drupal layouts ...

Preserve legibility

An even better solution...

Build a responsive theme that never requires a drastic size adjustment of micro-layouts.

desktop size... ~ same size on mobile!

Page 31: A "content-first" approach to designing responsive Drupal layouts ...

Preserve legibility

The holy grail?

desktop size... ~ same size on mobile!

Page 32: A "content-first" approach to designing responsive Drupal layouts ...

"Content First"

Considering preservation of content hierarchy and legibility

as a top priority.

Page 33: A "content-first" approach to designing responsive Drupal layouts ...

Back to Stanford...

Page 34: A "content-first" approach to designing responsive Drupal layouts ...
Page 35: A "content-first" approach to designing responsive Drupal layouts ...
Page 36: A "content-first" approach to designing responsive Drupal layouts ...

We started with content

We developed a "layout library" — sets of common layouts that we needed to support.

Page 37: A "content-first" approach to designing responsive Drupal layouts ...

Homepage layouts

Page 38: A "content-first" approach to designing responsive Drupal layouts ...

Landing page layouts

Page 39: A "content-first" approach to designing responsive Drupal layouts ...

Subpage layouts

Page 40: A "content-first" approach to designing responsive Drupal layouts ...

Articulating responsive behavior

We created a set of responsive flow wireframes.

Page 41: A "content-first" approach to designing responsive Drupal layouts ...

One and two sidebars

Page 42: A "content-first" approach to designing responsive Drupal layouts ...

No sidebars

Page 43: A "content-first" approach to designing responsive Drupal layouts ...

Content area blocks

Page 44: A "content-first" approach to designing responsive Drupal layouts ...

This is complicated!

Can we find a way to support all this sophisticated behavior in a theme?

Can we make it easy to implement for site builders and content creators?

Page 45: A "content-first" approach to designing responsive Drupal layouts ...

Where do we start?

Use an existing Drupal theme? •  Zen 5 •  Omega •  AdaptiveTheme

Build off of a responsive framework? •  Twitter Bootstrap •  Zurb •  Skeleton

Page 46: A "content-first" approach to designing responsive Drupal layouts ...

What we were looking for:

•  Preserving content hierarchy and legibility

•  Easy to implement

•  Scalability and flexibility of layout options

•  Support for complex layouts

•  Consideration for Drupal core features and common layout implementation strategies

•  Consideration of Stanford community context and technologies

Page 47: A "content-first" approach to designing responsive Drupal layouts ...

Build off Twitter Bootstrap

We decided to build our own theme off of Twitter Bootstrap, which would provide us with base styles and basic responsive behaviors.

twitter.github.com/bootstrap

Page 48: A "content-first" approach to designing responsive Drupal layouts ...

Default styles + responsive behavior

Drupal Theme

Base code that provides •  Styles and UI elements •  “Starter” responsive behavior

Page 49: A "content-first" approach to designing responsive Drupal layouts ...

Why Twitter Bootstrap?

Page 50: A "content-first" approach to designing responsive Drupal layouts ...

and also:

Open source o  Apache License v2.0

o  Documentation licensed under CC BY 3.0

Community engagement o  Git: 39,000 stars and 9,000 forks

Handles fixed and fluid layouts o  12-column grid system

o  Grid can be nested - infinite grid

Page 51: A "content-first" approach to designing responsive Drupal layouts ...

Introducing Open Framework

Page 52: A "content-first" approach to designing responsive Drupal layouts ...

Open Framework

A new responsive Drupal theme based on Twitter Bootstrap.

Page 53: A "content-first" approach to designing responsive Drupal layouts ...

Open Framework

Sophisticated Easy to use

Page 54: A "content-first" approach to designing responsive Drupal layouts ...

Sophisticated responsive behaviors

Open Framework provides support for two conflicting responsive patterns:

•  Row preference

•  Column preference

Page 55: A "content-first" approach to designing responsive Drupal layouts ...

Row Preference

Row preference forces elements to bump other elements down when the screen gets smaller.

We call these "flow" regions.

Page 56: A "content-first" approach to designing responsive Drupal layouts ...

Column Preference

Column preference forces elements to stack side-by-side in columns.

We call these "stacked" regions.

Page 57: A "content-first" approach to designing responsive Drupal layouts ...

A combination approach

Through a combination of stacked and flow region behaviors, we can create complex layouts that respond well at every breakpoint.

Page 58: A "content-first" approach to designing responsive Drupal layouts ...

New responsive regions

New set of responsive regions that support "flow" and "stacked" behavior.

Content placed in specific block regions will respond based on that region’s pre-defined behavior.

Page 59: A "content-first" approach to designing responsive Drupal layouts ...

Drupal-specific styles support

Open Framework takes the basics of Twitter Bootstrap and adds in Drupal-friendly, semantic styles.

Some examples:      .more-­‐link        .descriptor        .border-­‐simple  

Page 60: A "content-first" approach to designing responsive Drupal layouts ...

Support for common micro-layouts

We have developed a set of styles and implementation strategies for common micro-layouts we refer to as "postcard" layouts.

Page 61: A "content-first" approach to designing responsive Drupal layouts ...

Support for common micro-layouts

We have developed a set of styles and implementation strategies for common micro-layouts we refer to as "postcard" layouts.

<div  class="postcard-­‐left">    <div>left</div>    <div>right</div>  

</div>  

Page 62: A "content-first" approach to designing responsive Drupal layouts ...

.postcard-left .postcard-right

.postcard-le"-wrap .postcard-right-wrap

Page 63: A "content-first" approach to designing responsive Drupal layouts ...

A truly Drupal style guide

Open Framework has a sortable style guide.

Page 64: A "content-first" approach to designing responsive Drupal layouts ...

Responsive order overlay

Responsive order overlay toggle that shows how content hierarchy will be handled on small screens.

Page 65: A "content-first" approach to designing responsive Drupal layouts ...

Let's take a look...

http://openframework.stanford.edu

Page 66: A "content-first" approach to designing responsive Drupal layouts ...

Site Building with Open Framework

Page 67: A "content-first" approach to designing responsive Drupal layouts ...

Open Framework at Stanford

Open Framework provides the foundation for theme development at Stanford.

Page 68: A "content-first" approach to designing responsive Drupal layouts ...

Stanford Framework

Stanford Framework is a subtheme of Open Framework, providing branding and default styles for units at Stanford to use or subtheme.

Page 69: A "content-first" approach to designing responsive Drupal layouts ...
Page 70: A "content-first" approach to designing responsive Drupal layouts ...
Page 71: A "content-first" approach to designing responsive Drupal layouts ...

OFW styled with CSS Injector

Page 72: A "content-first" approach to designing responsive Drupal layouts ...

Modules that play nice

•  Block Class

•  Views

•  BEAN •  Context •  CSS Injector

Page 73: A "content-first" approach to designing responsive Drupal layouts ...

First blocks, then the world!

Region behaviors can be applied to panels regions, display suite layout regions, or even hand-coded regions.

Page 74: A "content-first" approach to designing responsive Drupal layouts ...

Using Open Framework

Download version 7.x-2.x on github github.com/SU-SWS/open_framework Visit the Open Framework website at openframework.stanford.edu If you want to participate, contact us to join the contribution team on Github.

Page 75: A "content-first" approach to designing responsive Drupal layouts ...

Places to learn more about RWD: •  “Responsive Web Design” by Ethan Marcotte (a book apart)

http://www.abookapart.com/products/responsive-web-design

•  LukeW — Multidevice Layout Patterns http://www.lukew.com and http://www.lukew.com/ff/entry.asp?1514

•  Jeffrey Zeldman — Content Firsthttp://www.zeldman.com/category/content-first/

•  A List Apart — Responsive Web Designhttp://www.alistapart.com/articles/responsive-web-design/

•  Ben Callahan — Responsive Retrofitting http://bencallahan.com/ and https://github.com/bencallahan/rwd-retrofitting

Page 76: A "content-first" approach to designing responsive Drupal layouts ...

Connect with us

http://openframework.stanford.edu #openframework

Megan Miller @meganerinmiller

[email protected]

Brian Young @auracreations

[email protected]