66

Component Driven Design and Development

Embed Size (px)

Citation preview

Page 1: Component Driven Design and Development
Page 2: Component Driven Design and Development

COMPONENT DRIVENDESIGN AND DEVELOPMENT

Cristina Chumillas

Page 3: Component Driven Design and Development

CRISTINA CHUMILLAS / @chumillas ckrina

Designer and frontend developer at Ymbra

Page 4: Component Driven Design and Development

WHAT ARE WE GOING TO TALKABOUT

ComponentsDesign SystemsCSS MethodologiesStyles GuidesIn Drupal

Page 5: Component Driven Design and Development

WEB PROJECTS

Page 6: Component Driven Design and Development
Page 7: Component Driven Design and Development

invisble

Page 8: Component Driven Design and Development

vsResponsiveInteractions...

Page 9: Component Driven Design and Development

COMPONENTS

Page 10: Component Driven Design and Development

invisble

Page 11: Component Driven Design and Development

<!-- Last News component -->

<div class="last-news"> <h2 class="last-news__title"> Últimas noticias </h2>

<ul class="last-news__list"> <li class="last-news__item">(...)</li> <li class="last-news__item">(...)</li> </ul>

<a class="last-news__more">Ver más</a> </div>

Page 12: Component Driven Design and Development

USE COMPONENTSTO MAKE SYSTEMS MODULAR

For a system to be modular, it must have interchangeableparts.

Page 13: Component Driven Design and Development

WHAT MAKES A COMPONENTMODULAR?

Standard & shared designCentralized codeControlled via system, not the userCustomizable options

Page 14: Component Driven Design and Development
Page 15: Component Driven Design and Development
Page 16: Component Driven Design and Development

“We’re not designing pages, we’redesigning systems of components.”

--Stephen Hay

Page 17: Component Driven Design and Development

DESIGN SYSTEMS

Page 18: Component Driven Design and Development

Everything that makes up your product.

--Mark Otto, FOWA 2013

Everything.Typography, layouts and grids, colors, icons, components, coding conventions...

Page 19: Component Driven Design and Development
Page 20: Component Driven Design and Development
Page 21: Component Driven Design and Development

WHY DESIGN SYSTEMS?Reusable work - COMPONENTS

More efficient projects

Large-scale ready code

Everybody knows how everything works

Integrates multi-disciplinary workflow

Page 22: Component Driven Design and Development

ATOMIC DESIGN

Page 24: Component Driven Design and Development
Page 25: Component Driven Design and Development
Page 26: Component Driven Design and Development
Page 27: Component Driven Design and Development
Page 28: Component Driven Design and Development
Page 29: Component Driven Design and Development

WHEN?

Page 30: Component Driven Design and Development

WIREFRAMESStatic wireframes vs HTML Wireframes

Page 31: Component Driven Design and Development

STATIC WIREFRAMESThey are abstractionsThey are full of assumptionsThey are never complete

Page 32: Component Driven Design and Development

HTML WIREFRAMESThey get into the browser quickerThey reinforce the notion that you’re creating a websiteThey are interactiveThey allow annotationsThey are the base for the final product

Page 33: Component Driven Design and Development

DESIGNStatic delirables vs HTML delirables-prototypes

Page 34: Component Driven Design and Development

DESIGNING IN THE BROWSERPSD for early planning/research phasesThe composition in the browserMake decisions in the browserReusable work > Developer will know how do you wantyou output

Page 35: Component Driven Design and Development

CSS METHODOLOGIES

Page 36: Component Driven Design and Development

OOCSS(Object Oriented CSS)

Based in Object Oriented programming paradigm:

Do One Thing WellSingle Responsibility Principle(1 responsability = 1 class)

Focuses on Separation of Concerns(SoC)

Page 37: Component Driven Design and Development

OOCSS(Object Oriented CSS)

/* Media Object */ .media {} .media .image {} .media .comment {}

Page 38: Component Driven Design and Development

BEM(Block Element Modifier)

.site-search {} /* Block */ .site-search__field {} /* Element */ .site-search--full {} /* Modifier */

Page 39: Component Driven Design and Development

BEM <div class="block-name__wrapper"> <div class="block-name"> <h2 class="block-name__title">Block title</h2> <p class="block-name__text">Block text</p> </div> </div>

Page 40: Component Driven Design and Development

SMACSS

Page 41: Component Driven Design and Development

STYLE GUIDESDocumentation of a Design System

Page 42: Component Driven Design and Development
Page 43: Component Driven Design and Development

WHY?Improve User ExperienceEasy onboarding of new team membersEfficient Design and DevelopmentMakes Testing easier

Page 44: Component Driven Design and Development
Page 45: Component Driven Design and Development
Page 46: Component Driven Design and Development
Page 47: Component Driven Design and Development

STYLEGUIDE DRIVENDEVELOPMENT(SDD)

Style guides that are generated directly from the styledefinition sources

Page 48: Component Driven Design and Development

KSS (KNYLE STYLE SHEETS)

Documentation specification and styleguide format.

Structured to be automatically extracted and processed.

Page 49: Component Driven Design and Development

base/

layout/

components/

pager/

_pager.scss

_pager.hbs

Page 50: Component Driven Design and Development

_pager.scss

// Pager//// Markup: pager.hbs//// Style guide: components.navigation.pager

.pager,%pager { margin: 0; // All the styles here.}

Page 51: Component Driven Design and Development

_pager.hbs

// Pager<ul class="pager {{modifier_class}}"> <li class="pager__item"> <a title="Go to page 1" href="/admin/content">1</a> </li> <li class="pager__item"> <a title="Go to page 2" href="/admin/content?page=1">2</a> </li> <li class="pager__current-item">3</li> <li class="pager__item"> <a title="Go to page 4" href="/admin/content?page=3">4</a> </li> <li class="pager__item"> <a title="Go to page 5" href="/admin/content?page=4">5</a> </li></ul>

Page 52: Component Driven Design and Development
Page 53: Component Driven Design and Development

STYLE GUIDES - RESOURCESstyleguides.io

Articles, Books, Podcasts, Talks, Tools, Examples, etc.

Page 54: Component Driven Design and Development

IN DRUPAL

Page 55: Component Driven Design and Development

GENERAL APPROACHES1. Wrapping components2. Changing default markup

Page 56: Component Driven Design and Development

OUR COMPONENTS TO DRUPALCOMPONENTS

In codeDisplay SuitePanels

Page 57: Component Driven Design and Development

IN CODEField formatterProcess and preprocess functionshook_(...)_alter

hook_page_alter()hook_form_alter()hook_node_view_alter()(...)

...

Page 58: Component Driven Design and Development

DISPLAY SUITEView modes

Page 59: Component Driven Design and Development

DISPLAY SUITEField templates (Display Suite extras)

Page 60: Component Driven Design and Development

PANELSCustom PanesTemplates for paneAdd class to the paneMini PanelsContext

Page 61: Component Driven Design and Development

PANELSCustom Panes (CTools Content Type or Plugin)

<?php

$plugin = array( 'single' => TRUE, 'title' => t('Menu shortcuts to the themes'), 'category' => t('MSF ES: Themes'), 'render callback' => 'jumpmenu_themes_render', 'admin info' => 'jumpmenu_themes_admin_info',);

/** * The 'admin info' callback for panel pane. */function jumpmenu_themes_admin_info($subtype, $conf, $contexts) { (...)}

/** * Render callback function. */function jumpmenu_themes_render($subtype, $conf, $args, $contexts) { (...)}

Page 62: Component Driven Design and Development

PANELSCustom template for pane

/** * Implements hook_preprocess_panels_pane(). */ function mymodule_preprocess_panels_pane(&$variables) {

switch ($variables['pane']->subtype) { case 'my-pane-name': $variables['template_files'][] = 'panels-pane-test'; break; } }

Page 63: Component Driven Design and Development

PANELSCustom class

/** * Implements hook_preprocess_panels_pane(). */ function mymodule_preprocess_panels_pane(&$variables) {

switch ($variables['pane']->subtype) { case 'my-pane-name': $classes = 'my-custum-class'; $variables['classes_array'][] = $classes; break; } }

Page 64: Component Driven Design and Development

PANELSMini-panels

Page 65: Component Driven Design and Development

PANELSContext

Page 66: Component Driven Design and Development

THANKS! / @chumillas ckrina

Drupal-generatedmarkup is not your

friend -- use astyleguide!

Robert CaracausTuesday 22 14:15-15:15

Room 112

Prototypes and Drupal: fromdesigning in-browser toimplementing custom

templates Yuriy Gerasimov and Morten Christoffersen

Wednesday 23 10:45-11:45Room 111