Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional 'eyebrow' to Text Introduction module #4004

Merged
merged 19 commits into from
Apr 18, 2018

Conversation

virginiacc
Copy link
Contributor

@virginiacc virginiacc commented Apr 12, 2018

While migrating the BAH journey content into Wagtail, we opted to use an H5 eyebrow above the H1 header in the Text Introduction module to give users additional information about the current step. We initially entered the eyebrow and heading content in the body field. This PR adds an optional pre-heading/eyebrow field to Text Introduction module to standardize the markup and make the eyebrow pattern available elsewhere in the site.

Additions

  • Eyebrow option in Text Introduction module

Testing

  1. Check out branch and run migrations
  2. Add a page with a TextIntroduction and verify that eyebrow displays correctly
  3. Verify that tests pass

Screenshots

Admin

screen shot 2018-04-12 at 8 40 42 am

Desktop

screen shot 2018-04-12 at 8 43 11 am

Mobile

screen shot 2018-04-12 at 8 44 29 am

Checklist

  • PR has an informative and human-readable title
  • Changes are limited to a single goal (no scope creep)
  • Code can be automatically merged (no conflicts)
  • Code follows the standards laid out in the development playbook
  • Passes all existing automated tests
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future todos are captured in comments
  • Visually tested in supported browsers and devices (see checklist below 👇)
  • Project documentation has been updated
  • Reviewers requested with the Reviewers tool ➡️

Testing checklist

Browsers

  • Chrome
  • Firefox
  • Safari
  • Internet Explorer 8, 9, 10, and 11
  • Edge
  • iOS Safari
  • Chrome for Android

Accessibility

  • Keyboard friendly
  • Screen reader friendly

Other

  • Is useable without CSS
  • Is useable without JS
  • Flexible from small to large screens
  • No linting errors or warnings
  • JavaScript tests are passing

@virginiacc virginiacc changed the title Text introduction eyebrow option Add optional eyebrow to Text Introduction module Apr 12, 2018
@virginiacc virginiacc changed the title Add optional eyebrow to Text Introduction module Add optional 'eyebrow' to Text Introduction module Apr 12, 2018
@@ -29,10 +31,19 @@
at the bottom of the molecule.

========================================================================== #}

{% if value.eyebrow and value.heading %}
Copy link
Member

Choose a reason for hiding this comment

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

Should this be {% if value.eyebrow or value.heading %}?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it could be just if value.eyebrow, since the validation ensures that if an eyebrow is present, a heading is required.

{% if value.heading %}
<h1>{{ value.heading }}</h1>
{% endif %}
{% if value.eyebrow and value.heading %}
Copy link
Member

Choose a reason for hiding this comment

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

Should be {% if value.eyebrow or value.heading %}?


h1,
.h1 {
.respond-to-max( @bp-xs-max, {
Copy link
Member

Choose a reason for hiding this comment

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

Should .respond-to-max( … enclose the h1, .h1 {?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with Ans that this would be cleaner. I'd also simplify the selector to

.eyebrow + h1,
.eyebrow + .h1 {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in 357720b

required=False,
help_text=('Optional: Adds an H5 eyebrow above H1 heading text. '
'Only use in conjunction with heading.'),
label="Pre-heading"
Copy link
Member

Choose a reason for hiding this comment

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

Should this be single quotes?

Copy link
Member

Choose a reason for hiding this comment

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

TRIVIAL: Also is space around = sign a style standard?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, quotes should be single quotes. No, weirdly, lack of space around the equals sign is the standard.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@anselmbradford Single quotes added in 1cde567 -- thanks for catching that!

For the spacing, I think the convention is that there is space around the equals sign except in keyword arguments.

Copy link
Contributor

@Scotchester Scotchester left a comment

Choose a reason for hiding this comment

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

Tests passed and everything worked as expected 👍

Just a few comments mostly building on what Ans wrote.

])}
)

return cleaned
Copy link
Contributor

Choose a reason for hiding this comment

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

Props for the custom validation here!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the great example in InfoUnitGroup! 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

All praise to @chosak!

@@ -29,10 +31,19 @@
at the bottom of the molecule.

========================================================================== #}

{% if value.eyebrow and value.heading %}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it could be just if value.eyebrow, since the validation ensures that if an eyebrow is present, a heading is required.

@@ -29,10 +31,19 @@
at the bottom of the molecule.

========================================================================== #}

{% if value.eyebrow and value.heading %}
<header>
Copy link
Contributor

Choose a reason for hiding this comment

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

This header element doesn't seem to be serving any purpose. Removing it on a rendered page with dev tools shows no difference.

Can we remove it? We also would not need the two conditionals, then.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd added the header to associate the eyebrow with the H1, but you're right, it doesn't seem to make a difference. Removed in 357720b

<header>
{% endif %}
{% if value.eyebrow %}
<div class="h5 eyebrow">{{ value.eyebrow }}</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

What would you think about removing the h5 class and applying it via mixin to .eyebrow?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good question. Could there ever be a non-H5 eyebrow, or is that styling a fundamental characteristic of an eyebrow in our usage?

Copy link
Contributor

Choose a reason for hiding this comment

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

That's also a good question :) Perhaps you could check with your designers for their input?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have asked for their feedback on this & will update when I have more info :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Scotchester It sounds like eyebrows will always be H5, so I went with the mixin approach in 844e383 -- thanks for the suggestion!


h1,
.h1 {
.respond-to-max( @bp-xs-max, {
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with Ans that this would be cleaner. I'd also simplify the selector to

.eyebrow + h1,
.eyebrow + .h1 {

required=False,
help_text=('Optional: Adds an H5 eyebrow above H1 heading text. '
'Only use in conjunction with heading.'),
label="Pre-heading"
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, quotes should be single quotes. No, weirdly, lack of space around the equals sign is the standard.

Copy link
Contributor

@Scotchester Scotchester left a comment

Choose a reason for hiding this comment

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

Thanks for the updates! Approved pending your response to one question and a tiny cleanup item.

.eyebrow {
.heading-5();
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you no longer need the media query to modify the margin between the eyebrow and its H1?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That margin is specifically added between h5/.h5 and h1/.h1 at small screen sizes in cf-base, so using the mixin makes the override unnecessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, great! Merge at will.

@@ -13,3 +13,6 @@ nav ol ol {
}

// END enhancement for normalize-legacy-addon



Copy link
Contributor

Choose a reason for hiding this comment

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

Could we remove these added blank lines, please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed in 4cfe69b

@virginiacc virginiacc merged commit 22891dc into master Apr 18, 2018
@virginiacc
Copy link
Contributor Author

Thanks, @anselmbradford & @Scotchester!

@virginiacc virginiacc deleted the text-introduction-eyebrow branch April 18, 2018 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants