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

Allow creating custom width containers and using them with template #1626

Merged
merged 5 commits into from
Nov 4, 2019

Conversation

hannalaakso
Copy link
Member

This PR:

  1. Makes it possible for govuk-width-container mixin to accept a width. It defaults to $govuk-page-width so that govuk-width-container class will continue to function as before. The mixin defaults to pixels if no unit is specified.
  2. Makes it possible for classes to be set on template container. This is necessary for setting custom width classes when needed, in addition to using .govuk-width-container by default. I called the new template option containerClasses following the naming in the header and footer which have containerClasses. These are "Classes that can be added to the inner container, useful if you want to make the header/footer full width."
  3. Adds an example of a page with the template with custom width for template, header and footer containers. I’ve used BEM for the custom class name in app.scss as doing so feels clearer and in the spirit of what this is doing (creating something based on the default width class), although actually nothing is being inherited from .govuk-width-container. Note that there’s a difference in how the header and footer add the govuk-width-container class: footer hardcodes the class whereas header overrides it with containerClasses. As nothing is being inherited from .govuk-width-container I'm not passing it again unnecessarily to the header.

Tested on:
🍏 Chrome
🍏 FF
🍏 IE11
🍏 IE8

Fixes #1567

Additionally, we'll be able to fix alphagov/govuk-design-system#798 when this PR is released.

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1626 October 31, 2019 09:56 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1626 October 31, 2019 10:01 Inactive
Copy link
Contributor

@NickColley NickColley left a comment

Choose a reason for hiding this comment

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

This is looking really good 🙌

I've added some comments I think the only thing that's blocking is making the CHANGELOG clearer how you use the new features.

app/views/examples/template-wide/index.njk Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
src/govuk/objects/_width-container.scss Outdated Show resolved Hide resolved
app/assets/scss/partials/_app.scss Outdated Show resolved Hide resolved
src/govuk/template.njk Show resolved Hide resolved
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1626 October 31, 2019 14:17 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1626 November 4, 2019 14:45 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1626 November 4, 2019 15:13 Inactive
@@ -4,7 +4,34 @@

### New features

#### Allow attributes to be set on `<body>` of template
#### Create custom width container classes
Copy link
Contributor

Choose a reason for hiding this comment

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

Very good work on the CHANGELOG, nice 👍

Default the width to `$govuk-page-width`. Default the units to
pixels if no unit is specified.

The mixin can be used for creating custom width container classes
which can be used for setting the width of both the main page content
and for the header and footer.
This is necessary for setting custom width classes to override
`.govuk-width-container`.

Follow the naming of header and footer which have `containerClasses` which
are "Classes that can be added to the inner container, useful if you want to
make the header/footer full width."
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1626 November 4, 2019 16:12 Inactive
Set it on the template, header and footer containers.

I’ve used BEM for the custom class name as it feels clearer and in the spirit of
what this is doing (creating something based on the default width class), although
actually nothing is being inherited from `.govuk-width-container`.

There’s a difference in how the header and footer treat `.govuk-width-container`:
footer hardcodes the class whereas header overrides it with `containerClasses`. As
nothing is being inherited from `.govuk-width-container` don't pass it again
unnecessarily, only `.govuk-width-container—wide`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Extending govuk-width-container mixin Example page templates are too wide
4 participants