Skip to content

Commit

Permalink
Restructure DS website's information architecture (#656)
Browse files Browse the repository at this point in the history
* Restructure DS website's information architecture

- Removes main nav and moves all nav elements to left-hand sidebar
- Changes nav categories
- Removes four netlify cms collections that were based on categories
  and replaces them with a single one called "Pages"
- Adds a netlify cms collection called "Navigation" that lets users
  edit the side nav
- Moves special pages like the homepage and the help page to a new
  collection called "Special pages"
- Updates tests and Jekyll/netlify metadata files as appropriate

https://GHE/CFPB/el-camino/issues/251

* Update website documentation and how-to-edit-stuff guide

* Remove the sample component page from the 'component' section

* Only show source tabs for fields with content

It's very, very difficult to check a string for emptiness with Liquid.

Shopify/liquid#223 (comment)

* Add sidebar to homepage

* Put anchor tags on own lines

Otherwise there's a space between the last word and the final period.
I could just put the last anchor tag on its own line but I don't want to
alienate it and make it feel uncomfortable.

* Fix BEM structure of side nav

* Properly check for empty sub categories in side nav
  • Loading branch information
contolini authored Jun 23, 2020
1 parent ec8e72d commit 243fe67
Show file tree
Hide file tree
Showing 107 changed files with 796 additions and 895 deletions.
110 changes: 110 additions & 0 deletions docs/_data/side-navigation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
first-level:
- heading: Foundation
second-level:
- heading: Basics
nav-items:
- page: Color
- page: Grid
- heading: Typography
nav-items:
- page: Headings
- page: Paragraphs
- page: Quotes
- heading: Brand symbools
nav-items:
- page: Beam pattern
- page: Logo
- page: Seal
- heading: Graphics
nav-items:
- page: Iconography
- page: Illustration
- page: Photography
- heading: Multimedia
nav-items:
- page: Animation
- page: Video
- heading: Components
second-level:
- heading: Alerts
nav-items:
- page: Banners
- page: Notifications
- heading: Behavior
nav-items:
- page: Expandables
- heading: Form elements
nav-items:
- page: Buttons
- page: Checkboxes
- page: Dropdowns and multi-selects
- page: Fieldsets
- page: Helper text
- page: Labels and legends
- page: Links
- page: Radio Buttons
- page: Range Sliders
- page: Text Inputs
- heading: Lists and tables
nav-items:
- page: Lists
- page: Tables
- heading: Patterns
second-level:
- heading: Interaction patterns
third-level:
- heading: Forms
nav-items:
- page: Forms
- page: E-mail Signup Forms
- page: Feedback Forms
- heading: Navigation
nav-items:
- page: Filterable list pages
- page: Pagination
- heading: Layout patterns
third-level:
- heading: Introductions
nav-items:
- page: Heroes
- page: Text introductions
- page: Item introductions
- heading: Featured content
nav-items:
- page: Cards
- page: Featured Content Module
- page: Wells
- heading: Main content
nav-items:
- page: "Info Unit Groups: Image and text"
- heading: Pages
nav-items:
- page: Landing pages
- page: Sublanding pages
- page: Browse pages
- page: Learn pages
- page: Filterable list pages
- page: Document detail pages
- heading: Development
second-level:
- heading: Atomic
nav-items:
- page: Atomic Components
- heading: Layout
nav-items:
- page: Base images
- page: Blocks
- page: Column dividers
- page: Main content and sidebars
- heading: Utilities
nav-items:
- page: Helper classes and mixins
- page: Media queries
- page: Variables
- heading: Guidelines
second-level:
- heading: Data visualization
nav-items:
- page: Bar Charts
- page: Line Charts
- page: Pie Charts
10 changes: 6 additions & 4 deletions docs/_includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
<div class="block block__sub">
<p>
<small>
<strong>Help improve this page:</strong>
<a href="https://github.com/{{ site.repository }}/issues/new?assignees=&labels=content%2C+help+wanted&template=component-needs-content-edits.md&title=Suggestions+for%3A+%22{{ page.title }}%22">
File an issue on GitHub.
</a>
Help improve this website by
<a href="https://github.com/{{ site.repository }}/issues/new?assignees=&labels=content%2C+help+wanted&template=component-needs-content-edits.md&title=Suggestions+for%3A+%22{{ page.title }}%22">filing an issue</a>
on GitHub,
<a href="{{ '/updating-this-website/#editing-pages' | relative_url }}">editing a page</a>
or
<a href="{{ '/updating-this-website/#creating-new-pages' | relative_url }}">creating a new page</a>.
</small>
</p>

Expand Down
4 changes: 2 additions & 2 deletions docs/_includes/generic-content.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<section class="content_main">

{% if page.markdown %}
{% if page.description %}
<div>
{{ page.markdown | markdownify }}
{{ page.description | markdownify }}
</div>
{% endif %}

Expand Down
33 changes: 0 additions & 33 deletions docs/_includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,5 @@ <h1 class="title">
<span class="demi">CFPB</span> Design System
</a>
</h1>

<nav class="global-nav" role="navigation">
<ul class="global-nav_list">
<li class="nav-list-item">
<a
class="{% if page.section == 'getting-started' %}active{% endif %}"
href="{{ site.baseurl }}/getting-started">
Getting Started
</a>
</li>
<li class="nav-list-item">
<a
class="{% if page.section == 'foundation' %}active{% endif %}"
href="{{ site.baseurl }}/foundation">
Foundation
</a>
</li>
<li class="nav-list-item">
<a
class="{% if page.section == 'components' %}active{% endif %}"
href="{{ site.baseurl }}/components">
Components
</a>
</li>
<li class="nav-list-item">
<a
class="{% if page.section == 'templates' %}active{% endif %}"
href="{{ site.baseurl }}/templates">
Templates
</a>
</li>
</ul>
</nav>
</div> <!-- /.wrapper -->
</header>
4 changes: 2 additions & 2 deletions docs/_includes/search.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<form id="search-form" action="{{ site.baseurl }}/search" method="get">
<label class="u-visually-hidden" for="search-box">Search:</label>
<input type="text" id="search-box" class="a-text-input" name="searchQuery" placeholder="enter your query">
<button class="a-btn" type="submit">Search!</button>
<input type="text" id="search-box" class="a-text-input" name="searchQuery" placeholder="Enter your query">
<button class="a-btn" type="submit">Search</button>
</form>
75 changes: 37 additions & 38 deletions docs/_includes/sidebar.html
Original file line number Diff line number Diff line change
@@ -1,46 +1,45 @@
{% comment %}
Create an empty array to store secondary nav sections
{% endcomment %}
{% assign secondary_sections = '' | split: ',' %}

{% for p in site.pages %}
{% if p.section == page.section and p.secondary_section %}
{% unless secondary_sections contains p.secondary_section %}
{% assign secondary_sections = secondary_sections | push: p.secondary_section %}
{% endunless %}
{% endif %}
{% endfor %}

{% comment %}
Alphabetize the sections
{% endcomment %}
{% assign secondary_sections = secondary_sections | sort %}

{% if secondary_sections %}
<ul class="m-list m-list__unstyled">
{% for secondary_section in secondary_sections | sort %}
{% for first in site.data.side-navigation.first-level %}
{% assign first_level_slug = first.heading | slugify %}
<li class="m-list_item u-mb15">
<span class="h5">{{ secondary_section }}</span>
<ul class="m-list m-list__links">
{% for p in site.pages %}
{% if p.section == page.section and p.secondary_section == secondary_section %}
<div class="h4">
<a class="m-list_link" href="{{ first_level_slug | relative_url }}">{{ first.heading }}</a>
</div>
{% if page.section == first_level_slug or page == blank %}
<div class="m-list_item-subgroup">
{% if first.nav-items | size > 0 %}
<ul class="m-list m-list__links">
{% for link in first.nav-items %}
<li class="m-list_item">
<a class="m-list_link" href="{{ p.url | relative_url }}">{{ p.title }}</a>
<a class="m-list_link" href="{{ first_level_slug | relative_url }}/{{ link.page | slugify }}">{{ link.page }}</a>
</li>
{% endfor %}
</ul>
{% endif %}
{% for second in first.second-level %}
<div class="h4 u-mt0">{{ second.heading }}</div>
{% if second.nav-items | size > 0 %}
<ul class="m-list m-list__links">
{% for link in second.nav-items %}
<li class="m-list_item">
<a class="m-list_link" href="{{ first_level_slug | relative_url }}/{{ link.page | slugify }}">{{ link.page }}</a>
</li>
{% endfor %}
</ul>
{% endif %}
{% for third in second.third-level %}
<div class="h5" style="margin-top:16px">{{ third.heading }}</div>
<ul class="m-list m-list__links">
{% for link in third.nav-items %}
<li class="m-list_item">
<a class="m-list_link" href="{{ first_level_slug | relative_url }}/{{ link.page | slugify }}">{{ link.page }}</a>
</li>
{% endfor %}
</ul>
{% endfor %}
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
{% else %}
<ul class="m-list m-list__links">
{% for p in site.pages %}
{% if p.section == page.section %}
<li class="m-list_item">
<a class="m-list_link" href="{{ p.url | relative_url }}">{{ p.title }}</a>
</li>
</div>
{% endif %}
{% endfor %}
</li>
{% endfor %}
</ul>
{% endif %}
38 changes: 19 additions & 19 deletions docs/_includes/variation-content.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,22 @@ <h3>{{ variation_name }}</h3>
</div>
{% endunless %}

{% assign code_snippet = variation.variation_code_snippet and variation.variation_code_snippet != '' %}
{% assign jinja_snippet = variation.variation_jinja_code_snippet and variation.variation_jinja_code_snippet != '' %}
{% assign implementation = variation.variation_implementation and variation.variation_implementation != '' %}
{% assign specs = variation.variation_specs and variation.variation_specs != '' %}
{% assign code_snippet = variation.variation_code_snippet | strip %}
{% assign jinja_snippet = variation.variation_jinja_code_snippet | strip %}
{% assign implementation = variation.variation_implementation | strip %}
{% assign specs = variation.variation_specs | strip %}

{% if code_snippet or jinja_snippet or implementation or specs %}
{% if code_snippet != "" or jinja_snippet != "" or implementation != "" or specs != "" %}

{% capture variation_slug %}
{%- capture variation_slug -%}
details-
{{ variation.variation_name }}
{{ variation.variation_description }}
{{ variation.variation_code_snippet }}
{{ variation.variation_jinja_code_snippet }}
{{ variation.variation_implementation }}
{{ variation.variation_specs }}
{% endcapture %}
{%- endcapture -%}
{% assign variation_slug = variation_slug | strip | slugify | truncate: 40, '' %}

<div class="a-toggle_code">
Expand All @@ -98,28 +98,28 @@ <h3>{{ variation_name }}</h3>

<div class="govuk-tabs u-hidden" data-module="tabs" id="{{ variation_slug }}-{{ forloop.index }}">
<ul class="govuk-tabs__list">
{% if code_snippet %}
{% if code_snippet != "" %}
<li class="govuk-tabs__list-item govuk-tabs__list-item--selected">
<a class="govuk-tabs__tab" href="#{{ variation_slug }}-html-code-snippet-{{ forloop.index }}">
HTML code snippet
</a>
</li>
{% endif %}
{% if jinja_snippet %}
{% if jinja_snippet != "" %}
<li class="govuk-tabs__list-item">
<a class="govuk-tabs__tab" href="#{{ variation_slug }}-jinja-code-snippet-{{ forloop.index }}">
Jinja code snippet
</a>
</li>
{% endif %}
{% if implementation %}
{% if implementation != "" %}
<li class="govuk-tabs__list-item">
<a class="govuk-tabs__tab" href="#{{ variation_slug }}-implementation-{{ forloop.index }}">
Implementation
</a>
</li>
{% endif %}
{% if specs %}
{% if specs != "" %}
<li class="govuk-tabs__list-item">
<a class="govuk-tabs__tab" href="#{{ variation_slug }}-specs-{{ forloop.index }}">
Specs
Expand All @@ -129,48 +129,48 @@ <h3>{{ variation_name }}</h3>
</ul>

<!-- HTML snippet -->
{% if code_snippet %}
{% if code_snippet != "" %}
<section class="govuk-tabs__panel" id="{{ variation_slug }}-html-code-snippet-{{ forloop.index }}">
<div class="variation-code-snippet">
<h4 class="variation-code-snippet-title">HTML code snippet</h4>
<div class="source-code">
<pre><code class="language-html">{{ variation.variation_code_snippet | xml_escape }}</code></pre>
<pre><code class="language-html">{{ code_snippet | xml_escape }}</code></pre>
</div>
</div>
</section>
{% endif %}

<!-- Jinja snippet -->
{% if jinja_snippet %}
{% if jinja_snippet != "" %}
<section class="govuk-tabs__panel govuk-tabs__panel--hidden" id="{{ variation_slug }}-jinja-code-snippet-{{ forloop.index }}">
<div class="variation-jinja-code-snippet">
<h4 class="variation-jinja-code-snippet-title">Jinja code snippet</h4>
<div class="source-code">
<pre><code class="language-html">{{ variation.variation_jinja_code_snippet | xml_escape }}</code></pre>
<pre><code class="language-html">{{ jinja_snippet | xml_escape }}</code></pre>
</div>
</div>
</section>
{% endif %}

<!-- Implementation details -->
{% if implementation %}
{% if implementation != "" %}
<section class="govuk-tabs__panel govuk-tabs__panel--hidden" id="{{ variation_slug }}-implementation-{{ forloop.index }}">
<div>
<h4 class="variation-implementation-title">Implementation details</h4>
<div style="padding:40px">
{{ variation.variation_implementation | markdownify }}
{{ implementation | markdownify }}
</div>
</div>
</section>
{% endif %}

<!-- Specs -->
{% if specs %}
{% if specs != "" %}
<section class="govuk-tabs__panel govuk-tabs__panel--hidden" id="{{ variation_slug }}-specs-{{ forloop.index }}">
<div>
<h4 class="variation-specs-title">Specs</h4>
<div style="padding:40px">
{{ variation.variation_specs | markdownify }}
{{ specs | markdownify }}
</div>
</div>
</section>
Expand Down
Loading

0 comments on commit 243fe67

Please sign in to comment.