component based theming with ui patterns
play

COMPONENT BASED THEMING WITH UI PATTERNS PRESENTED BY BRIAN PERRY - PowerPoint PPT Presentation

COMPONENT BASED THEMING WITH UI PATTERNS PRESENTED BY BRIAN PERRY November 18, 2017 BRIAN PERRY Hi! Currently living in Chicago burbs Interactive Developer at HS2 Solutions Loves style guide driven development and all things


  1. COMPONENT BASED THEMING WITH UI PATTERNS PRESENTED BY BRIAN PERRY November 18, 2017

  2. BRIAN PERRY Hi! • Currently living in Chicago ‘burbs • Interactive Developer at HS2 Solutions • Loves style guide driven development and all things Nintendo d.o: brianperry twitter: bricomedy nintendo: wabrian HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  3. HS2 SOLUTIONS Totally Unapproved Company Info Slide Pros: • Chicago area • Smart Drupal folks • Always looking for more smart Drupal Folks • Sent me here Cons: • People in the Midwest say ‘Pop’ instead of ‘Soda’ • Not HS1 Solutions HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  4. Component Based Theming With UI Patterns

  5. COMPONENT BASED THEMING WHAT IS IT? • Creating modular and re-usable elements • Building a design system, not a series of pages • Can use a living style guide for documentation and prototyping Tools like KSS and Pattern Lab • 5 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  6. COMPONENT BASED THEMING WHY TAKE A COMPONENT BASED APPROACH? • Efficient re-use Write once, use everywhere. • Within a single project and even across projects (beyond Drupal even) • • Well isolated chunks of code • Decoupling front and back end development Theming doesn’t have to come last • • Living style guide Simplifies coordination between designers and developers / developers and developers. • Rapid prototyping • 6 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  7. Component Based Theming With Without UI Patterns

  8. OUR COMPONENT 8 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  9. THE COMPONENT DIRECTORY Everything lives inside component directory in Pattern • Library SASS • Twig • JS • Other Assets • Pattern Data • 9 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  10. MARKUP AND STYLES 10 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  11. MAPPING TO DRUPAL paragraph--marketing-content-section.html.twig 11 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  12. PAIN POINTS IT WORKS, BUT… Requires quite a bit of debugging • Difficult for those not familiar with Twig / Render Array Structure • Easy to get carried away / break things Drupal depends on (Quickedit, Panels IPE) • card.twig is a black box to Drupal • 12 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  13. Component Based Theming With UI Patterns

  14. UI PATTERNS MODULE Define and manage components in a way that Drupal understands • Define UI Patterns as Drupal Plugins • Use defined patterns with component friendly modules Views, field groups, panels, display suite, paragraphs (requires field layout or display suite) • • Configure data mappings in the UI • Optional Pattern Library page exposed in Drupal • Also allows Drupal to: Preprocess patterns • Render patterns programmatically • 14 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  15. 15 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  16. UI PATTERNS LIBRARY SUBMODULE 16 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  17. DEFINING A PATTERN marketing-site-content-section.pattern.yml 17 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  18. DEFINING A PATTERN 18 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  19. DEFINING A PATTERN 19 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  20. DEFINING A PATTERN 20 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  21. CAN I GET A SUGGESTION? pattern-marketing-site-content-section.html.twig • If ’use:’ doesn’t make sense for you, default template suggestions exist. Could add your twig markup here • Can even include/extend/embed and map data. • • Can preprocess to add additional suggestions. See hook_theme_suggestions_alter() • 21 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  22. DRUPAL PATTERN LIBRARY 22 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  23. EXPOSING YOUR PATTERN IN DRUPAL And now for the part that everyone gets tripped up on…

  24. EXPOSING YOUR PATTERN IN DRUPAL INTEGRATION MODULES LOOKING FOR A PLACE TO START? • UI Patterns Layouts – makes patterns available via Layout • In 8.3 and above: Discovery Enable Field Layout • • UI Patterns Views – makes patterns available as views row Enable UI Patterns Layouts • style Begin enjoying your patterns anywhere layouts are • • UI Patterns Display Suite – makes patterns available as available. display suite field templates Paragraphs are common component friendly option. • UI Patterns Field Group – makes patterns available to field groups 24 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  25. CREATE PARAGRAPH TYPE 25 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  26. MANAGE DISPLAY: LAYOUT SETTINGS Select your pattern from the list. 26 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  27. MAP PARAGRAPH FIELDS TO PATTERN FIELDS 27 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  28. Beyond the Basics

  29. TESTIMONIAL BLOCK PATTERN 29 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  30. UI PATTERNS VIEWS 30 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  31. UI PATTERNS FIELD GROUP 31 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  32. UI PATTERNS FIELD GROUP 32 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  33. UI PATTERNS DISPLAY SUITE 33 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  34. RENDER USING TWIG FUNCTION 34 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  35. RENDER PATTERN PROGRAMMATICALLY 35 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  36. SUB-PATTERNS Not yet formally supported, but… 36 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  37. SUB-PATTERNS Can use nested paragraphs for same end result 37 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  38. CAN RENDER PATTERNS IN YOUR PATTERN PREVIEW 38 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  39. VARIANTS On roadmap, but twig variables may be enough in some cases 39 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  40. Workflow

  41. UI PATTERNS WITH AN EXTERNAL PATTERN LIBRARY Components begin life in Pattern Lab • Developing components that don’t yet exist • Smaller sub-components • Larger scale prototyping • • Components ‘graduate’ to a UI Pattern in Drupal Documented both in code and in pattern library • Predictable re-use anywhere a UI Pattern can be rendered • 41 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  42. INTEGRATING WITH UI PATTERNS Many possible options: • The UI / various integration modules. • Programmatically • Twig functions • • Pick an approach, stick to it. Document it. 42 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  43. UI Patterns in a Contributed Theme

  44. FOUNDATION PATTERNS THEME Exposes foundation building blocks – not opinionated about how they are used 44 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  45. FOUNDATION PATTERNS CONFIGURATION MODULE Pre-packaged paragraph types to jump start the use of the theme 45 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  46. Resources

  47. RESOURCES https://www.drupal.org/project/ui_patterns • Links to documentation and github repo / issue queue. • #ui_patterns on DrupalTwig Slack • UI Patterns Talk at DrupalCon Vienna • https://www.drupal.org/project/foundation_patterns • Github repo / developer sandbox • 47 HS2 SOLUTIONS | COMPONENT BASED THEMING WITH UI PATTERNS

  48. Questions? brian.perry@hs2solutions.com

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend