Skip to content

Commit

Permalink
docs(cookie banner): align cookie banner content left (#957)
Browse files Browse the repository at this point in the history
* docs(cookie banner): align cookie banner content left

* docs(cookie-banner): add text-wrap: pretty to cookie banner content to prevent orphans
  • Loading branch information
chrispymm authored Nov 25, 2024
1 parent 84811d4 commit 78e4c9e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/_includes/layouts/partials/header.njk
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
attributes: {
"data-module": "app-cookies"
},
classes: "govuk-cookie-banner--align-left",
hidden: true,
messages: [
{
headingText: "Cookies on MoJ Design System",
Expand Down
4 changes: 3 additions & 1 deletion docs/assets/javascript/cookies.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ Cookies.prototype.init = function () {
const configEncoded = localStorage.getItem("mojpl-cookies");
if (configEncoded) {
const config = JSON.parse(configEncoded);

this.load(config);
} else {
// If there is no config, show the cookie banner
this.$module.hidden = false;
}
};

Expand Down
1 change: 1 addition & 0 deletions docs/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ $govuk-assets-path: "../" !default;

// Custom documentation components
@import "./components/back-to-top";
@import "./components/cookie-banner";
@import "./components/copy-button";
@import "./components/example";
@import "./components/layout";
Expand Down
10 changes: 10 additions & 0 deletions docs/assets/stylesheets/components/_cookie-banner.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Override cookie banner to be left aligned
.govuk-cookie-banner--align-left {
.govuk-cookie-banner__message {
margin-left: 20px;
margin-right: 20px;
}
.govuk-cookie-banner__content {
text-wrap: pretty;
}
}

0 comments on commit 78e4c9e

Please sign in to comment.