diff --git a/app/assets/scss/app-ie8.scss b/app/assets/scss/app-ie8.scss index 88a20b34b6..9234d4fa7e 100644 --- a/app/assets/scss/app-ie8.scss +++ b/app/assets/scss/app-ie8.scss @@ -1,6 +1,2 @@ -// If you want to display the currently active breakpoint in the top -// right corner of your site during development, add the breakpoints -// to this list, ordered by width, e.g. (mobile, tablet, desktop). -$mq-show-breakpoints: (desktop); @import "../../../src/all-ie8"; @import "partials/app"; diff --git a/app/assets/scss/app.scss b/app/assets/scss/app.scss index d5b68abf58..2954948360 100644 --- a/app/assets/scss/app.scss +++ b/app/assets/scss/app.scss @@ -1,6 +1,4 @@ -// If you want to display the currently active breakpoint in the top -// right corner of your site during development, add the breakpoints -// to this list, ordered by width, e.g. (mobile, tablet, desktop). -$mq-show-breakpoints: (mobile, tablet, desktop); +$govuk-show-breakpoints: true; + @import "../../../src/all"; @import "partials/app"; diff --git a/src/components/button/_button.scss b/src/components/button/_button.scss index 71722a50c3..689016f7ce 100644 --- a/src/components/button/_button.scss +++ b/src/components/button/_button.scss @@ -4,6 +4,11 @@ @include govuk-exports("govuk/component/button") { + $govuk-button-colour: #00823b; + $govuk-button-hover-colour: darken($govuk-button-colour, 5%); + $govuk-button-shadow-colour: darken($govuk-button-colour, 15%); + $govuk-button-text-colour: $govuk-white; + // Because the shadow (s0) is visually 'part of' the button, we need to reduce // the height of the button to compensate by adjusting its padding (s1) and // increase the bottom margin to include it (s2). diff --git a/src/helpers/_media-queries.scss b/src/helpers/_media-queries.scss index 90bff65ad1..edf7fc4845 100644 --- a/src/helpers/_media-queries.scss +++ b/src/helpers/_media-queries.scss @@ -1,4 +1,23 @@ -// We use sass-mq module for media queries +// Import sass-mq as a helper for media queries + +// Pass our breakpoints and static breakpoint definitions through to sass-mq. +$mq-breakpoints: if(variable-exists(govuk-breakpoints), $govuk-breakpoints, ()); +$mq-static-breakpoint: if(variable-exists(govuk-ie8-breakpoint), $govuk-ie8-breakpoint, desktop); + +$mq-show-breakpoints: (); + +@if (variable-exists(govuk-show-breakpoints) and $govuk-show-breakpoints) { + $mq-show-breakpoints: map-keys($govuk-breakpoints); +} + +// When building a stylesheet for IE8, set $mq-responsive to false in order to +// 'rasterize' any media queries. + +@if (variable-exists(govuk-is-ie8) and $govuk-is-ie8) { + $mq-responsive: false; +} @else { + $mq-responsive: true; +} // This is a horrible, horrible hack to prevent the 'dev mode' CSS to display // the current breakpoint from being included multiple times. diff --git a/src/helpers/_typography.scss b/src/helpers/_typography.scss index ad02c2e1c9..aabf1f7b61 100644 --- a/src/helpers/_typography.scss +++ b/src/helpers/_typography.scss @@ -3,18 +3,18 @@ // Sets the font family and associated properties, such as font smoothing. Also // overrides the font for print. -@mixin govuk-typography-common($font-family: $govuk-font-stack) { +@mixin govuk-typography-common($font-family: $govuk-font-family) { font-family: $font-family; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; // If using NTA, include the font-face definition - @if ($govuk-font-stack == $govuk-nta-light) { + @if ($govuk-font-family == $govuk-font-family-nta) { @include govuk-font-face-nta; } @include mq($media-type: print) { - font-family: $govuk-font-stack-print; + font-family: $govuk-font-family-print; } } @@ -215,7 +215,7 @@ // Regular weights, tabular numbers @mixin govuk-font-regular-tabular { - @include govuk-typography-common($font-family: $govuk-nta-light-tabular); + @include govuk-typography-common($font-family: $govuk-font-family-tabular); @include govuk-typography-weight-regular; } @@ -262,7 +262,7 @@ // Bold weights, tabular numbers @mixin govuk-font-bold-tabular { - @include govuk-typography-common($font-family: $govuk-nta-light-tabular); + @include govuk-typography-common($font-family: $govuk-font-family-tabular); @include govuk-typography-weight-bold; } diff --git a/src/helpers/grid.test.js b/src/helpers/grid.test.js index ae111b3bdb..a88ab5e2fc 100644 --- a/src/helpers/grid.test.js +++ b/src/helpers/grid.test.js @@ -14,11 +14,15 @@ const sassConfig = { } describe('grid system', () => { const sassImports = ` - @import "tools/exports"; + @import "settings/ie8"; + @import "settings/media-queries"; @import "settings/spacing"; @import "settings/measurements"; + @import "helpers/grid"; @import "helpers/media-queries"; + + @import "tools/exports"; ` describe('grid-width function', () => { it('outputs the specified key value from the map of widths', async () => { @@ -115,7 +119,7 @@ describe('grid system', () => { box-sizing: border-box; width: 100%; padding: 0 15px; } - @media (min-width: 46.25em) { + @media (min-width: 40.0625em) { .govuk-grid-column-full { width: 100%; float: left; } }`) @@ -137,7 +141,7 @@ describe('grid system', () => { box-sizing: border-box; width: 100%; padding: 0 15px; } - @media (min-width: 46.25em) { + @media (min-width: 40.0625em) { .govuk-grid-column-two-thirds { width: 66.6666%; float: left; } } @@ -148,7 +152,7 @@ describe('grid system', () => { const sass = ` ${sassImports} - @include govuk-grid-column(three-quarters, $class:'large-columnumn'); + @include govuk-grid-column(three-quarters, $class:'large-column'); ` const results = await sassRender({ data: sass, ...sassConfig }) @@ -156,12 +160,12 @@ describe('grid system', () => { .toString() .trim()) .toBe(outdent` - .large-columnumn-three-quarters { + .large-column-three-quarters { box-sizing: border-box; width: 100%; padding: 0 15px; } - @media (min-width: 46.25em) { - .large-columnumn-three-quarters { + @media (min-width: 40.0625em) { + .large-column-three-quarters { width: 75%; float: left; } } `) @@ -182,7 +186,7 @@ describe('grid system', () => { .govuk-grid-column-one-quarter { box-sizing: border-box; padding: 0 15px; } - @media (min-width: 61.25em) { + @media (min-width: 48.0625em) { .govuk-grid-column-one-quarter { width: 25%; float: left; } } @@ -227,7 +231,7 @@ describe('grid system', () => { box-sizing: border-box; width: 100%; padding: 0 15px; } - @media (min-width: 46.25em) { + @media (min-width: 40.0625em) { .govuk-grid-column-one-half { width: 50%; float: right; } } diff --git a/src/helpers/spacing.test.js b/src/helpers/spacing.test.js index 41a941d0c7..95a8e13ead 100644 --- a/src/helpers/spacing.test.js +++ b/src/helpers/spacing.test.js @@ -14,7 +14,10 @@ const sassConfig = { } const sassBootstrap = ` - $mq-breakpoints: ( + @import "settings/media-queries"; + @import "settings/ie8"; + + $govuk-breakpoints: ( my_breakpoint: 30em ); diff --git a/src/helpers/typography.test.js b/src/helpers/typography.test.js index 8fff535fe4..350a6f319d 100644 --- a/src/helpers/typography.test.js +++ b/src/helpers/typography.test.js @@ -14,7 +14,10 @@ const sassConfig = { } const sassBootstrap = ` - $mq-breakpoints: ( + @import "settings/media-queries"; + @import "settings/ie8"; + + $govuk-breakpoints: ( my_breakpoint: 30em ); diff --git a/src/settings/_all.scss b/src/settings/_all.scss index 71170754d9..8bde28e9ed 100644 --- a/src/settings/_all.scss +++ b/src/settings/_all.scss @@ -16,6 +16,6 @@ @import "spacing"; @import "measurements"; -@import "typography-font-stacks"; +@import "typography-font-families"; @import "typography-font"; @import "typography-responsive"; diff --git a/src/settings/_assets.scss b/src/settings/_assets.scss index c937f7a36b..43a5b139f0 100644 --- a/src/settings/_assets.scss +++ b/src/settings/_assets.scss @@ -1,3 +1,7 @@ +//// +/// @group settings/assets +//// + /// Path to the assets directory, with trailing slash. /// /// This is the directory where the images and fonts subdirectories live. You @@ -5,18 +9,21 @@ /// README for details. /// /// @type String +/// @access public $govuk-assets-path: "/assets/" !default; /// Path to the images folder, with trailing slash. /// /// @type String +/// @access public $govuk-images-path: "#{$govuk-assets-path}images/" !default; /// Path to the fonts folder, with trailing slash. /// /// @type String +/// @access public $govuk-fonts-path: "#{$govuk-assets-path}fonts/" !default; @@ -37,10 +44,13 @@ $govuk-fonts-path: "#{$govuk-assets-path}fonts/" !default; /// @example scss - Custom asset handling /// /// @function my-url-handler($filename) { -/// @return ''; // Some custom URL handling +/// // Some custom URL handling +/// @return url('example.jpg'); /// } /// /// $govuk-image-url-function: 'my-url-handler'; +/// +/// @access public $govuk-image-url-function: false !default; @@ -61,9 +71,12 @@ $govuk-image-url-function: false !default; /// @example scss - Custom asset handling /// /// @function my-url-handler($filename) { -/// @return ''; // Some custom URL handling +/// // Some custom URL handling +/// @return url('example.woff'); /// } /// /// $govuk-font-url-function: 'my-url-handler'; +/// +/// @access public $govuk-font-url-function: false !default; diff --git a/src/settings/_colours-applied.scss b/src/settings/_colours-applied.scss index ccedb0a286..df14e8d804 100644 --- a/src/settings/_colours-applied.scss +++ b/src/settings/_colours-applied.scss @@ -1,59 +1,120 @@ -// Text colour +//// +/// @group settings/colours +//// -$govuk-text-colour: $govuk-black; -// Canvas background colour -// Used by the footer component and template to give the illusion of a long footer. -$govuk-canvas-background-colour: $govuk-grey-3; -// Body background colour -$govuk-body-background-colour: $govuk-white; +// ========================================================= +// Generic +// ========================================================= -// Text colour for print media -// -// Use 'true black' to avoid printers using colour ink to print body text +/// Text colour +/// +/// @type Colour +/// @access public -$govuk-print-text-colour: #000000; +$govuk-text-colour: $govuk-black !default; -// Secondary text colour -// -// Used for 'muted' text, help text, etc. +/// Canvas background colour +/// +/// Used by the footer component and template to give the illusion of a long footer. +/// +/// @type Colour +/// @access public -$govuk-secondary-text-colour: $govuk-grey-1; +$govuk-canvas-background-colour: $govuk-grey-3 !default; -// Links +/// Body background colour +/// +/// @type Colour +/// @access public + +$govuk-body-background-colour: $govuk-white !default; + +/// Text colour for print media +/// +/// Use 'true black' to avoid printers using colour ink to print body text +/// +/// @type Colour +/// @access public + +$govuk-print-text-colour: #000000 !default; + +/// Secondary text colour +/// +/// Used for 'muted' text, help text, etc. +/// +/// @type Colour +/// @access public + +$govuk-secondary-text-colour: $govuk-grey-1 !default; + +/// Focus colour +/// +/// Used for outline (and background, where appropriate) when interactive +/// elements (links, form controls) have keyboard focus. +/// +/// @type Colour +/// @access public -$govuk-link-colour: $govuk-blue; -$govuk-link-visited-colour: #4c2c92; -$govuk-link-hover-colour: $govuk-light-blue; -$govuk-link-active-colour: $govuk-light-blue; +$govuk-focus-colour: $govuk-yellow !default; -// Focus colour -// -// Used for outline (and background, where appropriate) when interactive -// elements (links, form controls) have keyboard focus. +/// Error colour +/// +/// Used to highlight error messages and form controls in an error state +/// +/// @type Colour +/// @access public +$govuk-error-colour: $govuk-red !default; -$govuk-focus-colour: $govuk-yellow; +/// Border colour +/// +/// Used for borders, separators, rules, keylines etc. +/// +/// @type Colour +/// @access public + +$govuk-border-colour: $govuk-grey-2 !default; + +/// Input border colour +/// +/// Used for form inputs and controls +/// +/// @type Colour +/// @access public + +$govuk-input-border-colour: $govuk-black !default; + + + +// ============================================================================= +// Links +// ============================================================================= -// Error colour -// -// Used to highlight error messages and form controls in an error state +/// Link colour +/// +/// @type Colour +/// @access public -$govuk-error-colour: $govuk-red; +$govuk-link-colour: $govuk-blue !default; -// Border colour -// -// Used for borders, separators, rules, keylines etc. +/// Visited link colour +/// +/// @type Colour +/// @access public -$govuk-border-colour: $govuk-grey-2; +$govuk-link-visited-colour: #4c2c92 !default; -// Used for form inputs and controls +/// Link hover colour +/// +/// @type Colour +/// @access public -$govuk-input-border-colour: $govuk-black; +$govuk-link-hover-colour: $govuk-light-blue !default; -// Buttons +/// Active link colour +/// +/// @type Colour +/// @access public -$govuk-button-colour: #00823b; -$govuk-button-hover-colour: darken($govuk-button-colour, 5%); -$govuk-button-shadow-colour: darken($govuk-button-colour, 15%); -$govuk-button-text-colour: $govuk-white; +$govuk-link-active-colour: $govuk-light-blue !default; diff --git a/src/settings/_compatibility.scss b/src/settings/_compatibility.scss index 12bc4c4151..f8cc1c8e22 100644 --- a/src/settings/_compatibility.scss +++ b/src/settings/_compatibility.scss @@ -1,33 +1,50 @@ -// We default these settings to true so that if they are missed we opt for a -// mild performance hit over a potential broken experience for the end-user. +//// +/// Compatibility with legacy repos (govuk_elements, govuk_frontend_tookkit and +/// govuk_template) settings +/// +/// We default these settings to `true` so that if they are missed we opt for a +/// mild performance hit over a potential broken experience for the end-user. +/// +/// @group settings/compatibility +//// + /// Compatibility Mode: alphagov/govuk_frontend_toolkit /// -/// @type Boolean True if used in a project that also includes -/// alphagov/govuk_frontend_toolkit. +/// True if used in a project that also includes alphagov/govuk_frontend_toolkit. +/// +/// @type Boolean +/// @access public $govuk-compatibility-govukfrontendtoolkit: true !default; /// Compatibility Mode: alphagov/govuk_template /// -/// @type Boolean True if used in a project that also includes -/// alphagov/govuk_template +/// True if used in a project that also includes alphagov/govuk_template. +/// +/// @type Boolean +/// @access public $govuk-compatibility-govuktemplate: true !default; /// Compatibility Mode: alphagov/govuk_elements /// -/// @type Boolean True if used in a project that also includes -/// alphagov/govuk_elements +/// True if used in a project that also includes alphagov/govuk_elements. +/// +/// @type Boolean +/// @access public $govuk-compatibility-govukelements: true !default; /// Compatibility Product Map /// -/// @type Map Map of product names to their settings that we can use to lookup -/// states from within the `@govuk-compatibility` mixin. +/// Maps product names to their settings that we can use to lookup states from +/// within the `@govuk-compatibility` mixin. +/// +/// @type Map +/// @access private -$govuk-compatibility: ( +$_govuk-compatibility: ( govuk_frontend_toolkit: $govuk-compatibility-govukfrontendtoolkit, govuk_template: $govuk-compatibility-govuktemplate, govuk_elements: $govuk-compatibility-govukelements, diff --git a/src/settings/_global-styles.scss b/src/settings/_global-styles.scss index e5be624abf..d356129e8e 100644 --- a/src/settings/_global-styles.scss +++ b/src/settings/_global-styles.scss @@ -1,3 +1,13 @@ -// set to include optional globals styles +//// +/// @group settings/global-styles +//// + +/// Include 'global' styles +/// +/// Whether to style paragraphs (`