Skip to content

Commit

Permalink
Use consistent naming for container and wrapper
Browse files Browse the repository at this point in the history
- Rename `side-width-container` to `width-container`, `content` to `main-wrapper`
- Move gutter and site width definitions to settings
- Update app to use new class names
  • Loading branch information
36degrees committed Dec 12, 2017
1 parent 103adbc commit 4c01202
Show file tree
Hide file tree
Showing 13 changed files with 188 additions and 186 deletions.
2 changes: 1 addition & 1 deletion src/components/cookie-banner/_cookie-banner.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
}

.govuk-c-cookie-banner__message {
@include govuk-site-width-container;
@include govuk-width-container;
}

@include mq($media-type: print) {
Expand Down
4 changes: 2 additions & 2 deletions src/globals/scss/_common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@

// Objects
@import "objects/grid";
@import "objects/site-width-container";
@import "objects/main-wrapper";
@import "objects/shapes";
@import "objects/content-wrapper";
@import "objects/width-container";

// Overrides
@import "overrides/spacing";
Expand Down
20 changes: 0 additions & 20 deletions src/globals/scss/objects/_content-wrapper.scss

This file was deleted.

4 changes: 0 additions & 4 deletions src/globals/scss/objects/_grid.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// Gutters
$govuk-gutter: $govuk-spacing-scale-6;
$govuk-gutter-half: $govuk-gutter / 2;

@mixin govuk-grid {
@include govuk-h-clearfix;
margin-right: - ($govuk-gutter-half);
Expand Down
22 changes: 22 additions & 0 deletions src/globals/scss/objects/_main-wrapper.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Example usage:
// <div class="govuk-o-width-container">
// <!-- Breadcrumbs, phase banners, back links are placed in here. -->
// <div class="govuk-o-main-wrapper">
// <!-- Wrapper for the main content of your page which applies padding
// to the top / bottom -->
// </div>
// </div>

@mixin govuk-main-wrapper {
padding: $govuk-spacing-scale-3 0;

@include mq($from: tablet) {
padding: $govuk-spacing-scale-6 0;
}
}

@include exports("main-wrapper") {
.govuk-o-main-wrapper {
@include govuk-main-wrapper;
}
}
28 changes: 0 additions & 28 deletions src/globals/scss/objects/_site-width-container.scss

This file was deleted.

28 changes: 28 additions & 0 deletions src/globals/scss/objects/_width-container.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
@mixin govuk-width-container {
// Limit the width of the container to the page width
max-width: $govuk-page-width;

@include ie-lte(8) {
width: $govuk-page-width;
}

// On mobile, add half width gutters
margin: 0 $govuk-gutter-half;

// On tablet, add full width gutters
@include mq($from: tablet) {
margin: 0 $govuk-gutter;
}

// As soon as the viewport is greater than the width of the page plus the
// gutters, just centre the content instead of adding gutters.
@include mq($and: "(min-width: #{($govuk-page-width + $govuk-gutter * 2)})") {
margin: 0 auto;
}
}

@include exports("width-container") {
.govuk-o-width-container {
@include govuk-width-container;
}
}
6 changes: 6 additions & 0 deletions src/globals/scss/settings/_measurements.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// Site width and grid gutters
$govuk-page-width: 960px;

$govuk-gutter: $govuk-spacing-scale-6;
$govuk-gutter-half: $govuk-gutter / 2;

// Border widths
$govuk-border-width-mobile: 4px;
$govuk-border-width-tablet: 5px;
Expand Down
2 changes: 1 addition & 1 deletion src/views/component-list.njk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "layout-debug.njk" %}

{% block content %}
<div class="govuk-o-content">
<div class="govuk-o-main-wrapper">
<h1 class="govuk-heading-l">
GOV.UK Frontend - Components
</h1>
Expand Down
Loading

0 comments on commit 4c01202

Please sign in to comment.