SlideShare a Scribd company logo
1 of 79
A practical guide to how we built
a self-documenting digital pattern library
digitalcommunications@st-andrews.ac.uk
Introduction
 What are you interested in?
 Do you have a digital pattern library?
Objectives
 When does a pattern library fit into a redesign process?
 What is a pattern?
 How to identify patterns
 How to build patterns
 Governance
Why a digital pattern library?
What is a digital pattern library?
Advantages/disadvantages of digital pattern libraries
How to start using or
developing a pattern library
Standards Content Design Modules Pattern
library• Code
• Content
• Naming conventions
Version control
Git flow
Gitkraken
Standards Content Design Modules Pattern
library• Code
• Content
• Naming conventions
Test Test TestTestTest
Standards Content Design Modules Pattern
library• Code
• Content
• Naming conventions
Standardise
Testing Testing TestingTestingTesting
Simplify Consolidate
Start small
Does this approach resonate with you?
What is a pattern for
the University of St Andrews?
Header
Navigation bar
Hero banner
Navbox grid
and navboxes
Tile grid
and tiles
Category header
Navigation bar
Header
Breadcrumbs
Content whole
Navbox grid Navboxes
Footer
What is a pattern for you?
 What is core and optional?
 What variations would you allow?
 What names would you give the patterns?
University of St Andrews digital pattern library
Our philosophy – build on firm foundations
Our philosophy – write once
<div class="accordion">
<h3>Moral, Political and Legal Philosophy</h3>
<div>
<p>...</p>
</div>
</div>
Website
Web applications
Documentation
Examples
Our philosophy – easy way to build options
Our philosophy - test driven development
<div class="accordion">
<h3>Moral, Political and Legal Philosophy</h3>
<div>
<p>...</p>
</div>
</div>
Pattern
library
Our philosophy – standalone pattern library
Our philosophy – platform agnostic
Pattern library uses the pattern library
Building a pattern from scratch
Pattern library
Pattern template
• HTML + handlebars
• Sass (CSS)
• JavaScript
Options
• JSON
Documentation
Code
• screen.css
• print.css
• core.min.js
Documentation template
• HTML + handlebars
1
2
3
4
Grunt
Pattern library
Pattern template
• HTML + handlebars
• Sass (CSS)
• JavaScript
Options
• JSON
Documentation
Code
• screen.css
• print.css
• core.min.js
Documentation template
• HTML + handlebars
1
2
3
4
Grunt
Step 1 – Create pattern template demo
Design prototype website
Identify pattern to be built
Accordion
Extract code
<div class="accordion">
<h3>Moral, Political and Legal Philosophy</h3>
<div>
<p>...</p>
</div>
</div>
Optimise code: HTML
<div class="accordion">
<h3 aria-expanded="false" aria-controls="accordion-0" role="tab" tabindex="0">Moral, Political
and Legal Philosophy</h3>
<div id="accordion-0" aria-hidden="true" role="tabpanel">
<p>...</p>
</div>
</div>
 Accessible
 Responsive
 Standards
Optimise code: Sass (_accordion.scss)
Optimise code: JavaScript (accordion.js)
Pattern template
<div class="accordion">
<h3 aria-expanded="false" aria-controls="accordion-0" role="tab" tabindex="0">{{{ accordion-heading }}}</h3>
<div>{{{ accordion-content }}}</div>
</div>
<div class="accordion">
<h3 aria-expanded="false" aria-controls="accordion-0" role="tab" tabindex="0">Moral, Political and Legal
Philosophy</h3>
<div id="accordion-0" aria-hidden="true" role="tabpanel">
<p>...</p>
</div>
</div>
Optimised HTML
Handlebars
Pattern library
Pattern template
• HTML + handlebars
• Sass (CSS)
• JavaScript
Options
• JSON
Documentation
Code
• screen.css
• print.css
• core.min.js
Documentation template
• HTML + handlebars
1
2
3
4
Grunt
Step 2 – create options JSON
{
"options": [
{
"option-heading": "Single accordion",
"option-description": "",
"option-anchor": "single",
"accordion": {
"accordion-heading": "Moral, Political and Legal Philosophy",
“accordion-content": "<p>Lorem ipsum dolor sit amet...</p>"
}
}
]
}
<div class="accordion">
<h3 …>{{{ accordion-heading }}}</h3>
<div>{{{ accordion-content }}}</div>
</div>
Options – JSON
Pattern template
{
"options": [
{
"option-heading": "Single accordion",
"option-description": "",
"option-anchor": "single",
"accordion": {
"accordion-heading": "Moral, Political and Legal Philosophy",
“accordion-content": "<p>Lorem ipsum dolor sit amet...</p>"
}
}
]
}
<div class="accordion">
<h3 …>{{{ accordion-heading }}}</h3>
<div>{{{ accordion-content }}}</div>
</div>
Options – JSON
Documentation template
Pattern template
Pattern library
Pattern template
• HTML + handlebars
• Sass (CSS)
• JavaScript
Options
• JSON
Documentation
Code
• screen.css
• print.css
• core.min.js
Documentation template
• HTML + handlebars
1
2
3
4
Grunt
Step 3 – create documentation template
Options JSON
Option 1
Option 2
Option 3
{
{
{ }
}
}
Documentation template
Instructions and rules
Documentation template
Pattern template
Pattern option 1
Pattern option 2
Pattern option 3
Pattern library
Documentation – dummy template
---
title: Dummy pattern
---
<p class="alert alert-info">See CONTRIBUTING.md for details on how to create a new pattern.</p>
<p>The introduction may be several paragraphs long if required. It should introduce the pattern, explain what it is and when and where it may be used.</p>
<p>You may use any formatting as required, such as paragraphs and unordered lists:</p>
<ul>
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
<li>Aliquam tincidunt mauris eu risus.</li>
<li>Dolores tempore enim debitis totam</li>
</ul>
<p>Documentation should follow the writing for the web guidelines and adhere to the house style guide.</p>
<hr>
<h3>Options available</h3>
<ul>
{{#dummy-pattern-options.options}}
<li><a href="#{{option-anchor}}">{{option-heading}}</a></li>
{{/dummy-pattern-options.options}}
</ul>
{{#dummy-pattern-options.options}}
<hr>
<h3>{{option-heading}}</h3>
{{{option-description}}}
</div>{{> dummy-pattern}}<div class="container">
<span class="label label-default">Code</span>
<pre><code class="pattern-source html">{{> dummy-pattern}}</code></pre>
{{/dummy-pattern-options.options}}
Documentation – dummy template
---
title: Dummy pattern
---
<p class="alert alert-info">See CONTRIBUTING.md for details on how to create a new pattern.</p>
<p>The introduction may be several paragraphs long if required. It should introduce the pattern, explain what it is and when and where it may be used.</p>
<p>You may use any formatting as required, such as paragraphs and unordered lists:</p>
<ul>
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
<li>Aliquam tincidunt mauris eu risus.</li>
<li>Dolores tempore enim debitis totam</li>
</ul>
<p>Documentation should follow the writing for the web guidelines and adhere to the house style guide.</p>
<hr>
<h3>Options available</h3>
<ul>
{{#dummy-pattern-options.options}}
<li><a href="#{{option-anchor}}">{{option-heading}}</a></li>
{{/dummy-pattern-options.options}}
</ul>
{{#dummy-pattern-options.options}}
<hr>
<h3>{{option-heading}}</h3>
{{{option-description}}}
</div>{{> dummy-pattern}}<div class="container">
<span class="label label-default">Code</span>
<pre><code class="pattern-source html">{{> dummy-pattern}}</code></pre>
{{/dummy-pattern-options.options}}
Insert name of pattern
Documentation template
---
title: Accordion
---
<p>The accordion pattern presents an expandable and collapsible section of content. Accordions shorten pages and reduce scrolling, but they
require users to click on topic headings to find information. Therefore, accordions should be used sparingly. For more information see the <a
href="https://www.nngroup.com/articles/accordions-complex-content/"> Nielsen Norman Group report on accordion usability</a>.</p>
<h3>Rules for accordions</h3>
<ul>
<li>Must not be used when your audience needs most or all of the content on the page to answer their questions. It is better to
show all page content at once when the user case supports it. In such cases, do not worry about page length.</li>
<li>Must not be used in an aside.</li>
</ul>
<hr>
<h3>Options available</h3>
<ul>
{{#accordion-options.options}}
<li><a href="#{{option-anchor}}">{{option-heading}}</a></li>
{{/accordion-options.options}}
</ul>
{{#accordion-options.options}}
<hr>
<h3>{{option-heading}}</h3>
{{{option-description}}}
</div>{{> accordion}}<div class="container">
<span class="label label-default">Code</span>
<pre><code class="pattern-source html">{{> accordion}}</code></pre>
{{/accordion-options.options}}
Examples
(accordion-options.json)
Pattern
(accordion.hbs)
Insert rules
Pattern library
Pattern template
• HTML + handlebars
• Sass (CSS)
• JavaScript
Options
• JSON
Documentation
Code
• screen.css
• print.css
• core.min.js
Documentation template
• HTML + handlebars
1
2
3
4
Grunt
Pattern library
Pattern template
• HTML + handlebars
• Sass (CSS)
• JavaScript
Options
• JSON
Documentation
Code
• screen.css
• print.css
• core.min.js
Documentation template
• HTML + handlebars
1
2
3
4
Grunt
Step 4 – Grunt demo
Build and test pattern - Grunt
Build and test pattern – error in CSS
Build and test pattern – error in JSON
Accordion pattern in pattern library
Deploy
Documentation
www.st-andrews.ac.uk/dpl/1.4.0/
Code
www.st-andrews.ac.uk/cdn/1.4.0/screen.css
www.st-andrews.ac.uk/cdn/1.4.0/print.css
www.st-andrews.ac.uk/cdn/1.4.0/core.min.js
screen.css and print.css
core.min.js
Pattern library
Pattern template
• HTML + handlebars
• Sass (CSS)
• JavaScript
Options
• JSON
Documentation
Code
• screen.css
• print.css
• core.min.js
Documentation template
• HTML + handlebars
1
2
3
4
Grunt
https://github.com/standrewsdigital/digital-pattern-library
Questions and answers
 Would our pattern library be helpful for you? If so, how?
 Have we missed anything?
 What governance issues do you foresee? How would you overcome these?
sde1@st-andrews.ac.uk

More Related Content

What's hot (10)

HTML News Packages Lesson
HTML News Packages LessonHTML News Packages Lesson
HTML News Packages Lesson
 
Css
CssCss
Css
 
Css best practices style guide and tips
Css best practices style guide and tipsCss best practices style guide and tips
Css best practices style guide and tips
 
Wcphx 2012-workshop
Wcphx 2012-workshopWcphx 2012-workshop
Wcphx 2012-workshop
 
Inline, Block and Positioning in CSS
Inline, Block and Positioning in CSSInline, Block and Positioning in CSS
Inline, Block and Positioning in CSS
 
Intro to Web Development
Intro to Web DevelopmentIntro to Web Development
Intro to Web Development
 
Modular HTML & CSS
Modular HTML & CSSModular HTML & CSS
Modular HTML & CSS
 
CSS Best practice
CSS Best practiceCSS Best practice
CSS Best practice
 
Old Dog, New Tricks
Old Dog, New TricksOld Dog, New Tricks
Old Dog, New Tricks
 
Css week10 2019 2020 for g10 by eng.osama ghandour
Css week10 2019 2020 for g10 by eng.osama ghandourCss week10 2019 2020 for g10 by eng.osama ghandour
Css week10 2019 2020 for g10 by eng.osama ghandour
 

Similar to Digital pattern library

HTML CSS Best Practices
HTML CSS Best PracticesHTML CSS Best Practices
HTML CSS Best Practiceshoctudau
 
2022 HTML5: The future is now
2022 HTML5: The future is now2022 HTML5: The future is now
2022 HTML5: The future is nowGonzalo Cordero
 
Ifi7174 lesson1
Ifi7174 lesson1Ifi7174 lesson1
Ifi7174 lesson1Sónia
 
Advanced CSS Troubleshooting
Advanced CSS TroubleshootingAdvanced CSS Troubleshooting
Advanced CSS TroubleshootingDenise Jacobs
 
Web Accessibility for the 21st Century
Web Accessibility for the 21st CenturyWeb Accessibility for the 21st Century
Web Accessibility for the 21st Centurydreamwidth
 
ViA Bootstrap 4
ViA Bootstrap 4ViA Bootstrap 4
ViA Bootstrap 4imdurgesh
 
GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1Heather Rock
 
A practical guide to building websites with HTML5 & CSS3
A practical guide to building websites with HTML5 & CSS3A practical guide to building websites with HTML5 & CSS3
A practical guide to building websites with HTML5 & CSS3Darren Wood
 
Getting Started with Drupal
Getting Started with DrupalGetting Started with Drupal
Getting Started with DrupalNina McHale
 
Getting Started with Drupal
Getting Started with DrupalGetting Started with Drupal
Getting Started with DrupalRachel Vacek
 
Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 ...
Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 ...Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 ...
Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 ...Raj Lal
 
Design Systems, Pattern Libraries & WordPress
Design Systems, Pattern Libraries & WordPressDesign Systems, Pattern Libraries & WordPress
Design Systems, Pattern Libraries & WordPressJesse James Arnold
 
How to Build an Accessible WordPress Theme
How to Build an Accessible WordPress ThemeHow to Build an Accessible WordPress Theme
How to Build an Accessible WordPress ThemeGraham Armfield
 
Front end full stack development module 1pptx
Front end full stack development module 1pptxFront end full stack development module 1pptx
Front end full stack development module 1pptxMaruthiPrasad96
 
Fronttechnieken met HTML5 en de Slice-template
Fronttechnieken met HTML5 en de Slice-templateFronttechnieken met HTML5 en de Slice-template
Fronttechnieken met HTML5 en de Slice-templateInventis Web Architects
 
Getting Started with Drupal
Getting Started with DrupalGetting Started with Drupal
Getting Started with DrupalRachel Vacek
 
Blackboard DevCon 2011 - Performance Considerations for Custom Theme Development
Blackboard DevCon 2011 - Performance Considerations for Custom Theme DevelopmentBlackboard DevCon 2011 - Performance Considerations for Custom Theme Development
Blackboard DevCon 2011 - Performance Considerations for Custom Theme DevelopmentNoriaki Tatsumi
 

Similar to Digital pattern library (20)

HTML CSS Best Practices
HTML CSS Best PracticesHTML CSS Best Practices
HTML CSS Best Practices
 
2022 HTML5: The future is now
2022 HTML5: The future is now2022 HTML5: The future is now
2022 HTML5: The future is now
 
Ifi7174 lesson1
Ifi7174 lesson1Ifi7174 lesson1
Ifi7174 lesson1
 
Advanced CSS Troubleshooting
Advanced CSS TroubleshootingAdvanced CSS Troubleshooting
Advanced CSS Troubleshooting
 
Web Accessibility for the 21st Century
Web Accessibility for the 21st CenturyWeb Accessibility for the 21st Century
Web Accessibility for the 21st Century
 
html5_css3
html5_css3html5_css3
html5_css3
 
Lecture 2 - HTML Basics
Lecture 2 - HTML BasicsLecture 2 - HTML Basics
Lecture 2 - HTML Basics
 
ViA Bootstrap 4
ViA Bootstrap 4ViA Bootstrap 4
ViA Bootstrap 4
 
GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1GDI Seattle Intermediate HTML and CSS Class 1
GDI Seattle Intermediate HTML and CSS Class 1
 
A practical guide to building websites with HTML5 & CSS3
A practical guide to building websites with HTML5 & CSS3A practical guide to building websites with HTML5 & CSS3
A practical guide to building websites with HTML5 & CSS3
 
Getting Started with Drupal
Getting Started with DrupalGetting Started with Drupal
Getting Started with Drupal
 
Getting Started with Drupal
Getting Started with DrupalGetting Started with Drupal
Getting Started with Drupal
 
Artdm171 Week4 Tags
Artdm171 Week4 TagsArtdm171 Week4 Tags
Artdm171 Week4 Tags
 
Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 ...
Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 ...Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 ...
Accessible Design with HTML5 - HTML5DevConf.com May 21st San Francisco, 2012 ...
 
Design Systems, Pattern Libraries & WordPress
Design Systems, Pattern Libraries & WordPressDesign Systems, Pattern Libraries & WordPress
Design Systems, Pattern Libraries & WordPress
 
How to Build an Accessible WordPress Theme
How to Build an Accessible WordPress ThemeHow to Build an Accessible WordPress Theme
How to Build an Accessible WordPress Theme
 
Front end full stack development module 1pptx
Front end full stack development module 1pptxFront end full stack development module 1pptx
Front end full stack development module 1pptx
 
Fronttechnieken met HTML5 en de Slice-template
Fronttechnieken met HTML5 en de Slice-templateFronttechnieken met HTML5 en de Slice-template
Fronttechnieken met HTML5 en de Slice-template
 
Getting Started with Drupal
Getting Started with DrupalGetting Started with Drupal
Getting Started with Drupal
 
Blackboard DevCon 2011 - Performance Considerations for Custom Theme Development
Blackboard DevCon 2011 - Performance Considerations for Custom Theme DevelopmentBlackboard DevCon 2011 - Performance Considerations for Custom Theme Development
Blackboard DevCon 2011 - Performance Considerations for Custom Theme Development
 

Recently uploaded

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 

Recently uploaded (20)

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 

Digital pattern library

  • 1. A practical guide to how we built a self-documenting digital pattern library digitalcommunications@st-andrews.ac.uk
  • 2. Introduction  What are you interested in?  Do you have a digital pattern library?
  • 3. Objectives  When does a pattern library fit into a redesign process?  What is a pattern?  How to identify patterns  How to build patterns  Governance
  • 4. Why a digital pattern library?
  • 5.
  • 6.
  • 7. What is a digital pattern library?
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 17. How to start using or developing a pattern library
  • 18. Standards Content Design Modules Pattern library• Code • Content • Naming conventions
  • 19.
  • 20.
  • 21.
  • 23. Standards Content Design Modules Pattern library• Code • Content • Naming conventions Test Test TestTestTest
  • 24. Standards Content Design Modules Pattern library• Code • Content • Naming conventions Standardise Testing Testing TestingTestingTesting Simplify Consolidate
  • 26. Does this approach resonate with you?
  • 27. What is a pattern for the University of St Andrews?
  • 34.
  • 35. What is a pattern for you?
  • 36.  What is core and optional?  What variations would you allow?  What names would you give the patterns?
  • 37. University of St Andrews digital pattern library
  • 38. Our philosophy – build on firm foundations
  • 39. Our philosophy – write once <div class="accordion"> <h3>Moral, Political and Legal Philosophy</h3> <div> <p>...</p> </div> </div> Website Web applications Documentation Examples
  • 40. Our philosophy – easy way to build options
  • 41. Our philosophy - test driven development <div class="accordion"> <h3>Moral, Political and Legal Philosophy</h3> <div> <p>...</p> </div> </div> Pattern library
  • 42. Our philosophy – standalone pattern library
  • 43. Our philosophy – platform agnostic
  • 44. Pattern library uses the pattern library
  • 45. Building a pattern from scratch
  • 46. Pattern library Pattern template • HTML + handlebars • Sass (CSS) • JavaScript Options • JSON Documentation Code • screen.css • print.css • core.min.js Documentation template • HTML + handlebars 1 2 3 4 Grunt
  • 47. Pattern library Pattern template • HTML + handlebars • Sass (CSS) • JavaScript Options • JSON Documentation Code • screen.css • print.css • core.min.js Documentation template • HTML + handlebars 1 2 3 4 Grunt
  • 48. Step 1 – Create pattern template demo
  • 50. Identify pattern to be built Accordion
  • 51. Extract code <div class="accordion"> <h3>Moral, Political and Legal Philosophy</h3> <div> <p>...</p> </div> </div>
  • 52. Optimise code: HTML <div class="accordion"> <h3 aria-expanded="false" aria-controls="accordion-0" role="tab" tabindex="0">Moral, Political and Legal Philosophy</h3> <div id="accordion-0" aria-hidden="true" role="tabpanel"> <p>...</p> </div> </div>  Accessible  Responsive  Standards
  • 53. Optimise code: Sass (_accordion.scss)
  • 54. Optimise code: JavaScript (accordion.js)
  • 55. Pattern template <div class="accordion"> <h3 aria-expanded="false" aria-controls="accordion-0" role="tab" tabindex="0">{{{ accordion-heading }}}</h3> <div>{{{ accordion-content }}}</div> </div> <div class="accordion"> <h3 aria-expanded="false" aria-controls="accordion-0" role="tab" tabindex="0">Moral, Political and Legal Philosophy</h3> <div id="accordion-0" aria-hidden="true" role="tabpanel"> <p>...</p> </div> </div> Optimised HTML Handlebars
  • 56. Pattern library Pattern template • HTML + handlebars • Sass (CSS) • JavaScript Options • JSON Documentation Code • screen.css • print.css • core.min.js Documentation template • HTML + handlebars 1 2 3 4 Grunt
  • 57. Step 2 – create options JSON
  • 58. { "options": [ { "option-heading": "Single accordion", "option-description": "", "option-anchor": "single", "accordion": { "accordion-heading": "Moral, Political and Legal Philosophy", “accordion-content": "<p>Lorem ipsum dolor sit amet...</p>" } } ] } <div class="accordion"> <h3 …>{{{ accordion-heading }}}</h3> <div>{{{ accordion-content }}}</div> </div> Options – JSON Pattern template
  • 59. { "options": [ { "option-heading": "Single accordion", "option-description": "", "option-anchor": "single", "accordion": { "accordion-heading": "Moral, Political and Legal Philosophy", “accordion-content": "<p>Lorem ipsum dolor sit amet...</p>" } } ] } <div class="accordion"> <h3 …>{{{ accordion-heading }}}</h3> <div>{{{ accordion-content }}}</div> </div> Options – JSON Documentation template Pattern template
  • 60. Pattern library Pattern template • HTML + handlebars • Sass (CSS) • JavaScript Options • JSON Documentation Code • screen.css • print.css • core.min.js Documentation template • HTML + handlebars 1 2 3 4 Grunt
  • 61. Step 3 – create documentation template
  • 62. Options JSON Option 1 Option 2 Option 3 { { { } } } Documentation template Instructions and rules Documentation template Pattern template Pattern option 1 Pattern option 2 Pattern option 3 Pattern library
  • 63. Documentation – dummy template --- title: Dummy pattern --- <p class="alert alert-info">See CONTRIBUTING.md for details on how to create a new pattern.</p> <p>The introduction may be several paragraphs long if required. It should introduce the pattern, explain what it is and when and where it may be used.</p> <p>You may use any formatting as required, such as paragraphs and unordered lists:</p> <ul> <li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li> <li>Aliquam tincidunt mauris eu risus.</li> <li>Dolores tempore enim debitis totam</li> </ul> <p>Documentation should follow the writing for the web guidelines and adhere to the house style guide.</p> <hr> <h3>Options available</h3> <ul> {{#dummy-pattern-options.options}} <li><a href="#{{option-anchor}}">{{option-heading}}</a></li> {{/dummy-pattern-options.options}} </ul> {{#dummy-pattern-options.options}} <hr> <h3>{{option-heading}}</h3> {{{option-description}}} </div>{{> dummy-pattern}}<div class="container"> <span class="label label-default">Code</span> <pre><code class="pattern-source html">{{> dummy-pattern}}</code></pre> {{/dummy-pattern-options.options}}
  • 64. Documentation – dummy template --- title: Dummy pattern --- <p class="alert alert-info">See CONTRIBUTING.md for details on how to create a new pattern.</p> <p>The introduction may be several paragraphs long if required. It should introduce the pattern, explain what it is and when and where it may be used.</p> <p>You may use any formatting as required, such as paragraphs and unordered lists:</p> <ul> <li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li> <li>Aliquam tincidunt mauris eu risus.</li> <li>Dolores tempore enim debitis totam</li> </ul> <p>Documentation should follow the writing for the web guidelines and adhere to the house style guide.</p> <hr> <h3>Options available</h3> <ul> {{#dummy-pattern-options.options}} <li><a href="#{{option-anchor}}">{{option-heading}}</a></li> {{/dummy-pattern-options.options}} </ul> {{#dummy-pattern-options.options}} <hr> <h3>{{option-heading}}</h3> {{{option-description}}} </div>{{> dummy-pattern}}<div class="container"> <span class="label label-default">Code</span> <pre><code class="pattern-source html">{{> dummy-pattern}}</code></pre> {{/dummy-pattern-options.options}} Insert name of pattern
  • 65. Documentation template --- title: Accordion --- <p>The accordion pattern presents an expandable and collapsible section of content. Accordions shorten pages and reduce scrolling, but they require users to click on topic headings to find information. Therefore, accordions should be used sparingly. For more information see the <a href="https://www.nngroup.com/articles/accordions-complex-content/"> Nielsen Norman Group report on accordion usability</a>.</p> <h3>Rules for accordions</h3> <ul> <li>Must not be used when your audience needs most or all of the content on the page to answer their questions. It is better to show all page content at once when the user case supports it. In such cases, do not worry about page length.</li> <li>Must not be used in an aside.</li> </ul> <hr> <h3>Options available</h3> <ul> {{#accordion-options.options}} <li><a href="#{{option-anchor}}">{{option-heading}}</a></li> {{/accordion-options.options}} </ul> {{#accordion-options.options}} <hr> <h3>{{option-heading}}</h3> {{{option-description}}} </div>{{> accordion}}<div class="container"> <span class="label label-default">Code</span> <pre><code class="pattern-source html">{{> accordion}}</code></pre> {{/accordion-options.options}} Examples (accordion-options.json) Pattern (accordion.hbs) Insert rules
  • 66. Pattern library Pattern template • HTML + handlebars • Sass (CSS) • JavaScript Options • JSON Documentation Code • screen.css • print.css • core.min.js Documentation template • HTML + handlebars 1 2 3 4 Grunt
  • 67. Pattern library Pattern template • HTML + handlebars • Sass (CSS) • JavaScript Options • JSON Documentation Code • screen.css • print.css • core.min.js Documentation template • HTML + handlebars 1 2 3 4 Grunt
  • 68. Step 4 – Grunt demo
  • 69. Build and test pattern - Grunt
  • 70. Build and test pattern – error in CSS
  • 71. Build and test pattern – error in JSON
  • 72. Accordion pattern in pattern library
  • 75.
  • 76. Pattern library Pattern template • HTML + handlebars • Sass (CSS) • JavaScript Options • JSON Documentation Code • screen.css • print.css • core.min.js Documentation template • HTML + handlebars 1 2 3 4 Grunt
  • 78. Questions and answers  Would our pattern library be helpful for you? If so, how?  Have we missed anything?  What governance issues do you foresee? How would you overcome these?

Editor's Notes

  1. Examples of the University of St Andrews crest from a number of different sites to demonstrate the current lack of standards.
  2. Another example of non-standard websites. Having websites that are built in different ways and hosted on different platforms places a burden on support and maintenance. It also makes websites difficult and time consuming to redevelop or extend their existing functionality. Having a standard approach to building components and websites would reduce the overall cost and risk to the institution.
  3. Example pattern library: BBC GEL http://www.bbc.co.uk/gel
  4. Example pattern library: GOV.UK service manual https://www.gov.uk/service-manual/design
  5. http://bradfrost.com/blog/post/atomic-web-design/ http://patternlab.io/
  6. Bootstrap pattern library http://getbootstrap.com/
  7. Material design https://material.io/ Material Design (codenamed Quantum Paper) is a design language developed in 2014 by Google. Expanding upon the "card" motifs that debuted in Google Now, Material Design makes more liberal use of grid-based layouts, responsive animations and transitions, padding, and depth effects such as lighting and shadows.
  8. http://www.material-ui.com/
  9. http://ui-patterns.com/
  10. Before work can begin on a pattern library you need to start by defining the standards for content and code. Otherwise inconsistencies will creep in and require reworking. Also need naming conventions for patterns and associated resources.
  11. The digital communications team service manual defines the standards we use https://www.st-andrews.ac.uk/digital-standards/service-manual/
  12. We have guidelines for how our code (e.g. HTML, PHP and CSS) code should be formatted https://github.com/standrewsdigital/digital-code-style-guide
  13. Example screenshot from our house style https://www.st-andrews.ac.uk/digital-standards/service-manual/house-style/
  14. Also important to agree on standards such as naming conventions and tagging and how you are going to work together. We use: Github Gitflow Gitkraken
  15. At each stage you need to make sure you test the standards, the content, design etc. with developers and users.
  16. Overall objective is to standardise, simplify and consolidate what we do into digital patterns.
  17. How to eat an elephant? Don’t need to tackle everything at once. Start somewhere – we only created patterns that we needed for a given project.
  18. A pattern for us consists of code, documentation and examples.
  19. Header pattern
  20. Navigation bar pattern
  21. Hero banner pattern
  22. Navbox and navbox grid patterns
  23. Tile grid and tiles patterns
  24. An example of another page built using components from our pattern library.
  25. The pattern library can be seen at www.st-andrews.ac.uk/dpl
  26. Workshop exercise to evaluate what is a pattern by analysing a number of different university home pages.
  27. Things to think about when creating a new pattern.
  28. Why have we built our own DPL – documentation alongside code Build from firm foundations (Bootstrap) Write once One step documentation and code Accessible Responsive Examples Test driven The DPL uses the DPL Platform agnostic Standalone DPL
  29. Our pattern library is built off Bootstrap. This means that we effectively have hundreds of experts working on our code for free! Bootstrap has been modified to make our own within the guidelines of Bootstrap. This means it is maintainable. For example, we have implemented University of St Andrews colours.
  30. The pattern is written once and then used in a number of different outputs.
  31. The pattern library provides an easy way to create different options for the patterns.
  32. The pattern library automatically checks for syntax errors in the code.
  33. The pattern library doesn’t rely on server side technologies such as PHP or MySQL.
  34. The pattern library is not optimised for a particular platform.
  35. www.st-andrews.ac.uk/dpl/
  36. There are four steps to creating a pattern.
  37. The first step is to create the pattern template.
  38. Build a prototype website based on user need and content required. Then identify patterns that need to be built and their variations. For example, we have an accordion pattern in the following page: https://standrewsdigital.org.uk/subjects/philosophy/
  39. This is the accordion pattern we want to build.
  40. The first step is to extract the HTML code from the prototype.
  41. The HTML code is then optimised to ensure it is accessible and compliant with standards.
  42. We also need to optimise the CSS code. We use Sass so we can include variables for colours.
  43. In the accordion example we also need to have JavaScript code that will ensure that it doesn’t rely on a mouse click to open or close it.
  44. In this example, we want to specify the heading and content text via Handlebars variables.
  45. The next step is to recreate the options that will be provided for each example.
  46. The options file sets the values for the Handlebars variables.
  47. The option-heading, option-description and option-anchor variables are identical for every pattern. These are used to create the documentation.
  48. Steps 1 and 2 are now complete.
  49. The options JSON file interacts with the pattern template and documentation template to create an entry in the pattern library.
  50. The documentation starts with a dummy template.
  51. The dummy template is edited to provide the name of the pattern.
  52. The dummy documentation template is edited to provide the rules for the pattern.
  53. With steps 1, 2 and 3 complete we can process everything via Grunt.
  54. Grunt is run to create the pattern library.
  55. This screenshot shows a simulated error in CSS.
  56. Simulated error in the JSON file
  57. Example of accordion pattern in the pattern library.
  58. The output of the Grunt script is a set of web pages and three source files that are referenced by any page that uses the pattern library.
  59. Example source code showing references to digital pattern library code.
  60. Example of the accordion pattern on live page: https://www.st-andrews.ac.uk/subjects/philosophy/
  61. The pattern is complete.
  62. The pattern library relies on these technologies. Visit GitHub (https://github.com/standrewsdigital/digital-pattern-library) to download the code. Further instructions on how to set up the pattern library are also found on GitHub.
  63. Lessons learnt at the University of St Andrews: Accommodating third party applications needs compromise. Don't use DPL before fully tested. Education and user engagement is not easy - needs to be planned in advanced and continually reviewed. Whole team needs skills to support our DPL. There is a technical overhead in learning our DPL. Successful DPL needs user testing throughout. Gather user requirements before building patterns. Challenge of how to roll out revised code to third party applications. Have standards before starting. If users ask for a new pattern there needs to be a process for dealing with this. Need clear ownership of DPL. Need rigour in CMS to make it work. Pair programming ensures quality. Internal training sessions (digital visa) trains editors to use the correct pattern. Uses existing framework (Bootstrap) – gave us a head start – have removed elements we don’t support or require. Non technical people can easily find the HTML. Developers save time as the design decisions have been made. Need good comms plan for new and revised patterns. Closer integration between DPL and T4 would be beneficial e.g. trace where pattern is being used in the CMS, update CMS automatically based on changes to DPL.