Skip to content
This repository has been archived by the owner on Jun 26, 2018. It is now read-only.

DP-5234/DP-5177 Refine and Refactor Patterns #571

Merged
merged 473 commits into from
Sep 14, 2017
Merged

Conversation

legostud
Copy link

@legostud legostud commented Aug 28, 2017

Description

Several patterns have been updated to make them more modular by including other patterns, more flexible by adding options, or more maintainable by using proper variables, the documentation has been updated to use ` instead of ' for variable names, and unused Patterns were tagged as obsolete.

Related Issue / Ticket

https://jira.state.ma.us/browse/DP-5234

Steps to Test

  1. Updated NPM -> Remove your styleguide/node_modules folder, then run npm install and gulp to verify that gulp still runs without errors.

Impacted Areas in Application

  • The package.json file was upgraded to work with npm 5.2.0
  • Button - removed extra white space around text
  • Input checkbox - Added optional icon (used on location filters)
  • Page Title - new atom (h1)
  • Cat Icon - switched small variable to type boolean
  • Action Step - replaced download links with Form Downloads organism
  • Arrow Nav - replaced a with link atom
  • Back Button - refactored to use Button atom
  • Banner Credit - new molecule.
  • Event Filters - converted submit button to a button atom
  • Icon Links - added Comp Heading
  • Image Promo - refactored data object to make description == richText
  • Location Filters - removed Checkbox Icon (use new optional icon with checkbox atom instead)
  • Page Intro - new molecule
  • Search Banner Form - changed the data object to use the proper namespace
  • Callout Alert - refactored data object to make calloutAlert == decorativeLink (doesn't included that pattern anymore)
  • Callout Time - Added option to change the icon the used.
  • Form Requirements - changed to use an h2 for the title.
  • Helpful Links - Marked as obsolete - replaced with linked list
  • Link List - Added option to hide bullets
  • Rich Text - removed property tag
  • Search Banner - Updated markup and data object to include other patterns
  • Stacked Row Section - Marked as obsolete
  • Suggested Pages - Refactored to use an image atom
  • Emergency Alerts - Changed code to allow the header to be rendered by itself.
  • Transition Page - replaced submit button with button atom
  • Services Template - updated to remove sidebar heading above link list.
  • Stacked Row Template - updated to contain code from the stacked row section organism
  • Error Pages - updated to use Link List instead of Helpful Links
  • Homepage - moved the Search Banner into the pre-content area.

Notes

Today I learned...

Jonathan Dallas added 30 commits July 31, 2017 15:48
@legostud legostud changed the base branch from C4-Docs to DP-5177-RefinePatternDocs August 28, 2017 17:26
@legostud legostud changed the base branch from DP-5177-RefinePatternDocs to C4-Docs August 28, 2017 18:24
@legostud legostud changed the title DP-5234 Refactor Patterns DP-5234/DP-5177 Refine and Refactor Patterns Sep 6, 2017
Copy link
Contributor

@jesconstantine jesconstantine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@legostud - lots of great work here! I do have some questions, mostly questioning / confirming backwards compatibility since we're targeting a minor release with these changes.

Thank you!

title="{{ button.info }}">
{{ button.text }}
</a>
title="{{ button.info }}">{{ button.text }}</a>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if the spaceless tag would be useful for situations like this as well?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know there was a spaceless tag. Good to know.

@@ -2,4 +2,4 @@
This is a variant of the [Cat Icon](./?p=atoms-cat-icon) pattern showing it is in a smaller size.

### How to generate
* set the "small" variable to "true"
* set the `small` variable to "true"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the .json and .md file, I think this should be true (boolean) vs "true" (string) - right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct

{% set smallClass = catIcon.small ? "ma__category-icon--small" : "" %}

{# Backward compatible with Release5.7.0 where small was a string value #}
{% if catIcon.small is same as ("false") %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For my own learning, this is because a non-empty string is truthy, correct?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, "" is a truthy value. Same as "false" is also truthy.

{% endfor %}
</div>
{% set formDownloads = { "downloadLinks": actionStep.downloadLinks } %}
{% include "@organisms/by-author/form-downloads.twig" %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a backwards compatible change? I didn't see any other occurrences of __downloads does that mean the css is still available to style both markup versions until the next major release? Should we start a list of changes like this? Or add a comment in the pattern .scss file?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment already existing in the scss file

&__downloads {
margin-bottom: 1em; // for v5.6 and below

<a href="{{ backButton.link.href }}" aria-label="{{ backButton.link.info }}">{{ backButton.link.text }}</a>
{% set button = backButton.button %}

{# backward compatible with v5.6 - swapped custom link with a button #}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

{% include "@organisms/by-template/jump-links.twig" %}
{% for stackedRowSection in stackedRowSections %}
{% include "@organisms/by-author/stacked-row-section.twig" %}
{% endfor %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just confirming that this is a non-breaking change because we're extending stacked-row-template which still accepts stackedRowSections - correct?

@@ -33,7 +33,7 @@ emergencyAlerts: {
emergencyHeader: {
type: emergencyHeader / required
},
alerts: [{
alerts (optional): [{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

<button class="ma__button-minor ma__button-minor--small" onClick="window.history.back();" type="button">{{ transitionPage.back }}</button>
<button class="ma__button ma__button--small" type="submit">{{ transitionPage.submit }}</button>
<button class="ma__button ma__button--minor ma__button--small" onClick="window.history.back();" type="button">{{ transitionPage.back }}</button>
{# backward compatible with v5.6 - check for old 'submit' variable #}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -44,8 +44,6 @@
{% include "@atoms/09-media/image.twig" %}
{% endif %}
{% if introSidebar.social %}
{% set sidebarHeading = introSidebar.social.sidebarHeading %}
{% include "@atoms/04-headings/sidebar-heading.twig" %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For my own learning, this works because we've added iconLinks.compHeading which has a sub property to render as an old sidebar heading - correct?

Is it backwards compatible if we send the compHeading outside of social links as we likely are in massgov now?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works, because we added iconLinks.compHeading and the .sidebar has CSS that renders Comp Headings like Sidebar Headings.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and no it's not backwards compatible if the twig changes prior to the data layer

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding that backwards compatible logic!

{% block preContent %}
{% include "@organisms/by-author/search-banner.twig" %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this change the data structure in a way that's backwards compatible?

Copy link
Author

@legostud legostud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I've address all the comments

title="{{ button.info }}">
{{ button.text }}
</a>
title="{{ button.info }}">{{ button.text }}</a>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know there was a spaceless tag. Good to know.

@@ -2,4 +2,4 @@
This is a variant of the [Cat Icon](./?p=atoms-cat-icon) pattern showing it is in a smaller size.

### How to generate
* set the "small" variable to "true"
* set the `small` variable to "true"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct

{% set smallClass = catIcon.small ? "ma__category-icon--small" : "" %}

{# Backward compatible with Release5.7.0 where small was a string value #}
{% if catIcon.small is same as ("false") %}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, "" is a truthy value. Same as "false" is also truthy.

{% endfor %}
</div>
{% set formDownloads = { "downloadLinks": actionStep.downloadLinks } %}
{% include "@organisms/by-author/form-downloads.twig" %}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment already existing in the scss file

&__downloads {
margin-bottom: 1em; // for v5.6 and below

<div class="ma__banner-credit">
<div class="ma__banner-credit__container">
<div class="ma__banner-credit__icon">
{% include "@atoms/05-icons/svg-marker-outline.twig" %}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's pretty easy.

{% include "@molecules/page-intro.twig" %}

{% set searchBannerForm = searchBanner.searchBannerForm %}
{% include "@molecules/search-banner-form.twig" %}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, I think I made an assumption here that the twig and variables would be updated at the same time which may not be the case for mass.gov.

@@ -44,8 +44,6 @@
{% include "@atoms/09-media/image.twig" %}
{% endif %}
{% if introSidebar.social %}
{% set sidebarHeading = introSidebar.social.sidebarHeading %}
{% include "@atoms/04-headings/sidebar-heading.twig" %}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works, because we added iconLinks.compHeading and the .sidebar has CSS that renders Comp Headings like Sidebar Headings.

@@ -44,8 +44,6 @@
{% include "@atoms/09-media/image.twig" %}
{% endif %}
{% if introSidebar.social %}
{% set sidebarHeading = introSidebar.social.sidebarHeading %}
{% include "@atoms/04-headings/sidebar-heading.twig" %}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and no it's not backwards compatible if the twig changes prior to the data layer

@@ -3,5 +3,5 @@
{% block narrowContent %}
{% include "@organisms/by-template/error-page.twig" %}
{% include "@molecules/header-search.twig" %}
{% include "@organisms/by-author/helpful-links.twig" %}
{% include "@organisms/by-author/link-list.twig" %}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case we don't need it to be Backward Compatible. Pages are never consumed only reviewed as examples.

@@ -3,5 +3,5 @@
{% block narrowContent %}
{% include "@organisms/by-template/error-page.twig" %}
{% include "@molecules/header-search.twig" %}
{% include "@organisms/by-author/helpful-links.twig" %}
{% include "@organisms/by-author/link-list.twig" %}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pages are just examples and as such don't need to be backward compatible.

Copy link
Contributor

@jesconstantine jesconstantine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@legostud awesome work! I think you've addressed everything! Thanks for going back through and adding some more backwards compatible logic - I appreciate it! I think this is ready to be merged!

@legostud legostud merged commit 9e77d2b into C4-Docs Sep 14, 2017
@legostud legostud deleted the DP-5234-RefactorPatterns branch September 14, 2017 14:03
@jesconstantine jesconstantine mentioned this pull request Sep 29, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants