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

Simplify main wrapper spacing logic #1371

Merged
merged 4 commits into from
May 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,15 @@

([PR #1367](https://github.com/alphagov/govuk-frontend/pull/1367))

- Simplify `.govuk-main-wrapper` logic to avoid the need for large modifier in most cases.

By using :first-child we can avoid the need for a modifier class, which is often missed.

We are also deprecating mixins for main wrapper.
We're not sure these are useful, so these will be removed in a future release, if you are using this please let us know: https://github.com/alphagov/govuk-frontend/issues/1379

([PR #1371](https://github.com/alphagov/govuk-frontend/pull/1371))

- Pull Request Title goes here

Description goes here (optional)
Expand Down
1 change: 0 additions & 1 deletion app/views/full-page-examples/confirm-delete/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
{% set homepage_url = "/" %}
{% set pageTitle = "Are you sure you want to delete Josh Lyman’s account?" %}
{% block page_title %}GOV.UK - {{ pageTitle }}{% endblock %}
{% set mainClasses = "govuk-main-wrapper--l" %}

{% block content %}
<div class="govuk-grid-row">
Expand Down
4 changes: 1 addition & 3 deletions app/views/full-page-examples/feedback/confirm.njk
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
{% set pageTitle = "Thank you for your feedback" %}
{% block pageTitle %}GOV.UK - {{ pageTitle }}{% endblock %}

{% set mainClasses = "govuk-main-wrapper--l" %}

{% block header %}
{% include "../../partials/banner.njk" %}
{{ govukHeader({
Expand All @@ -22,4 +20,4 @@
}) }}
</div>
</div>
{% endblock %}
{% endblock %}
2 changes: 0 additions & 2 deletions app/views/full-page-examples/feedback/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ notes: Based on https://www.signin.service.gov.uk/feedback
{% set pageTitle = "Send your feedback to GOV.UK Verify" %}
{% block pageTitle %}{{ "Error: " if errors }}GOV.UK - {{ pageTitle }}{% endblock %}

{% set mainClasses = "govuk-main-wrapper--l" %}

{% block header %}
{% include "../../partials/banner.njk" %}
{{ govukHeader({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
{% set pageTitle = "Thank you for confirming if you have changed your name" %}
{% block pageTitle %}GOV.UK - {{ pageTitle }}{% endblock %}

{% set mainClasses = "govuk-main-wrapper--l" %}

{% block content %}
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
{% set pageTitle = "Thank you for selecting your identity provider" %}
{% block pageTitle %}GOV.UK - {{ pageTitle }}{% endblock %}

{% set mainClasses = "govuk-main-wrapper--l" %}

{% block content %}
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
Expand Down
4 changes: 1 addition & 3 deletions app/views/full-page-examples/passport-details/confirm.njk
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
{% set pageTitle = "Passport details submitted" %}
{% block pageTitle %}GOV.UK - {{ pageTitle }}{% endblock %}

{% set mainClasses = "govuk-main-wrapper--l" %}

{% block content %}
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
Expand All @@ -15,4 +13,4 @@
}) }}
</div>
</div>
{% endblock %}
{% endblock %}
2 changes: 0 additions & 2 deletions app/views/full-page-examples/passport-details/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ scenario: >-
{% set pageTitle = "Passport details" %}
{% block pageTitle %}{{ "Error: " if errors }}GOV.UK - {{ pageTitle }}{% endblock %}

{% set mainClasses = "govuk-main-wrapper--l" %}

{% block beforeContent %}
{{ govukBackLink({
text: "Back"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
{% set pageTitle = "Account details updated" %}
{% block pageTitle %}GOV.UK - {{ pageTitle }}{% endblock %}

{% set mainClasses = "govuk-main-wrapper--l" %}

{% block content %}
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
Expand All @@ -15,4 +13,4 @@
}) }}
</div>
</div>
{% endblock %}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ scenario: >-
{% set pageTitle = "Update your account details" %}
{% block pageTitle %}{{ "Error: " if errors }}GOV.UK - {{ pageTitle }}{% endblock %}

{% set mainClasses = "govuk-main-wrapper--l" %}

{% block beforeContent %}
{{ govukBackLink({
text: "Back"
Expand Down
4 changes: 1 addition & 3 deletions app/views/full-page-examples/upload-your-photo/confirm.njk
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
{% set pageTitle = "Photo submitted" %}
{% block pageTitle %}GOV.UK - {{ pageTitle }}{% endblock %}

{% set mainClasses = "govuk-main-wrapper--l" %}

{% block header %}
{% include "../../partials/banner.njk" %}
{{ govukHeader({
Expand All @@ -33,4 +31,4 @@
}) }}
</div>
</div>
{% endblock %}
{% endblock %}
2 changes: 0 additions & 2 deletions app/views/full-page-examples/upload-your-photo/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ scenario: >-
{% set pageTitle = "Upload your photo" %}
{% block pageTitle %}{{ "Error: " if errors }}GOV.UK - {{ pageTitle }}{% endblock %}

{% set mainClasses = "govuk-main-wrapper--l" %}

{% block header %}
{% include "../../partials/banner.njk" %}
{{ govukHeader({
Expand Down
2 changes: 0 additions & 2 deletions app/views/full-page-examples/what-is-your-address/confirm.njk
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
{% set pageTitle = "Thank you for confirming your address" %}
{% block pageTitle %}GOV.UK - {{ pageTitle }}{% endblock %}

{% set mainClasses = "govuk-main-wrapper--l" %}

{% block content %}
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
{% set pageTitle = "Thank you for confirming your nationality" %}
{% block pageTitle %}GOV.UK - {{ pageTitle }}{% endblock %}

{% set mainClasses = "govuk-main-wrapper--l" %}

{% block content %}
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
{% set pageTitle = "Thank you for confirming your postcode" %}
{% block pageTitle %}GOV.UK - {{ pageTitle }}{% endblock %}

{% set mainClasses = "govuk-main-wrapper--l" %}

{% block content %}
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
{% set pageTitle = "Thank you for confirming the last country you visited" %}
{% block pageTitle %}GOV.UK - {{ pageTitle }}{% endblock %}

{% set mainClasses = "govuk-main-wrapper--l" %}

{% block content %}
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
Expand Down
9 changes: 8 additions & 1 deletion src/objects/_main-wrapper.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
// </div>


/// @deprecated Replace this mixin with more direct references to the [spacing mixins](https://design-system.service.gov.uk/styles/spacing/#spacing-on-custom-components).
@mixin govuk-main-wrapper {
// In IE11 the `main` element can be used, but is not recognized –
// meaning it's not defined in IE's default style sheet,
Expand All @@ -37,7 +38,9 @@
}
}

// Use govuk-main-wrapper--l when you page does not have Breadcrumbs, phase banners or back links
/// Use govuk-main-wrapper--l when you page does not have Breadcrumbs, phase banners or back links.
///
/// @deprecated Replace this mixin with more direct references to the [spacing mixins](https://design-system.service.gov.uk/styles/spacing/#spacing-on-custom-components).
@mixin govuk-main-wrapper--l {
@include govuk-responsive-padding(8, "top");
}
Expand All @@ -47,6 +50,10 @@
@include govuk-main-wrapper;
}

// For most instances of main wrapper, :first-child will give the correct spacing without
// the need for the `l` modifier, but it is available in instances where there may be
// empty elements that would be difficult to remove.
.govuk-main-wrapper:first-child,
.govuk-main-wrapper--l {
@include govuk-main-wrapper--l;
}
Expand Down