Component Driven Design and Development
- 4. WHAT ARE WE GOING TO TALK
ABOUT
Components
Design Systems
CSS Methodologies
Styles Guides
In Drupal
- 11. <!-- 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>
- 13. WHAT MAKES A COMPONENT
MODULAR?
Standard & shared design
Centralized code
Controlled via system, not the user
Customizable options
- 18. Everything that makes up your product.
--Mark Otto, FOWA 2013
Everything.
Typography, layouts and grids, colors, icons, components, coding conventions...
- 21. WHY DESIGN SYSTEMS?
Reusable work - COMPONENTS
More efficient projects
Large-scale ready code
Everybody knows how everything works
Integrates multi-disciplinary workflow
- 32. HTML WIREFRAMES
They get into the browser quicker
They reinforce the notion that you’re creating a website
They are interactive
They allow annotations
They are the base for the final product
- 34. DESIGNING IN THE BROWSER
PSD for early planning/research phases
The composition in the browser
Make decisions in the browser
Reusable work > Developer will know how do you want
you output
- 36. OOCSS
(Object Oriented CSS)
Based in Object Oriented programming paradigm:
Do One Thing Well
Single Responsibility Principle
(1 responsability = 1 class)
Focuses on Separation of Concerns(SoC)
- 48. KSS (KNYLE STYLE SHEETS)
Documentation specification and styleguide format.
Structured to be automatically extracted and processed.
- 51. _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>
- 53. STYLE GUIDES - RESOURCES
styleguides.io
Articles, Books, Podcasts, Talks, Tools, Examples, etc.
- 61. PANELS
Custom 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) {
(...)
}
- 62. PANELS
Custom 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;
}
}
- 63. PANELS
Custom 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;
}
}
- 66. THANKS!
/@chumillas ckrina
Drupal-generated
markup is not your
friend -- use a
styleguide!
Robert Caracaus
Tuesday 22 14:15-15:15
Room 112
Prototypes and Drupal: from
designing in-browser to
implementing custom
templates
Yuriy Gerasimov and Morten Christoffersen
Wednesday 23 10:45-11:45
Room 111