Files
notifications-admin/app/assets/stylesheets/components/cookie-message.scss
Tom Byers 3e8ed578d0 Improvements based on frontend feedback
Paired with @aliuk2012 on the implementation and
with a view to making the component generic enough
to be used on digital marketplace apps as well.
These changes came from that session.

They include:
- removal of an unused `data-accept-cookies`
  attribute
- removal of `govuk-!-padding-top-4` class and
  moving of associated styles into component CSS
- swapping out the `aria-label` on the parent
  element for an `aria-describedby` linked to the
  h2 to have one thing labelling the banner region
- removal of unused CSS and any already provided
  by the govuk-button class
- inclusion of @import's for styles attached to
  govuk-body and govuk-button classes
2020-01-20 10:03:36 +00:00

145 lines
3.2 KiB
SCSS

// GOV.UK Publishing components cookie banner styles
// https://github.com/alphagov/govuk_publishing_components/blob/master/app/assets/stylesheets/govuk_publishing_components/components/_cookie-banner.scss
// sass-lint:disable mixins-before-declarations
// component uses .govuk-body and .govuk-button classes from govuk-frontend
@import 'core/typography';
@import 'components/button/_button';
.notify-cookie-banner__wrapper {
@include govuk-responsive-padding(4, "top");
@include govuk-responsive-padding(4, "bottom");
}
.notify-cookie-banner__with-js {
display: none;
}
.notify-cookie-banner__no-js {
display: block;
}
.js-enabled {
.notify-cookie-banner__no-js,
.notify-cookie-banner {
display: none; // shown with JS, always on for non-JS
}
.notify-cookie-banner__with-js {
display: block;
}
}
.notify-cookie-banner__buttons {
@include govuk-clearfix;
@include govuk-media-query($from: desktop) {
display: inline-block;
}
}
.notify-cookie-banner__button {
display: inline-block;
width: 100%;
@include govuk-media-query($from: mobile, $until: desktop) {
&.notify-cookie-banner__button-accept {
float: left;
width: 49%;
}
&.notify-cookie-banner__button-reject {
.js-enabled & {
float: right;
width: 49%;
}
}
}
@include govuk-media-query($from: desktop) {
width: auto;
}
@include govuk-media-query($until: 455px) {
width: 100%;
}
}
.notify-cookie-banner__button-accept {
display: none;
.js-enabled & {
display: inline-block;
}
}
.notify-cookie-banner__confirmation {
display: none;
position: relative;
padding: govuk-spacing(4) 0;
@include govuk-media-query($from: desktop) {
padding: govuk-spacing(4);
}
// This element is focused using JavaScript so that it's being read out by screen readers
// for this reason we don't want to show the default outline or emphasise it visually using `govuk-focused-text`
&:focus {
outline: none;
}
}
.notify-cookie-banner__confirmation-message,
.notify-cookie-banner__hide-button {
display: block;
@include govuk-media-query($from: desktop) {
display: inline-block;
}
}
.notify-cookie-banner__confirmation-message {
margin-right: govuk-spacing(4);
@include govuk-media-query($from: desktop) {
max-width: 90%;
}
}
.notify-cookie-banner__hide-button {
@include govuk-font($size: 19);
outline: 0;
border: 0;
background: none;
text-decoration: underline;
padding: govuk-spacing(0);
margin-top: govuk-spacing(2);
right: govuk-spacing(3);
@include govuk-media-query($from: desktop) {
margin-top: govuk-spacing(0);
position: absolute;
right: govuk-spacing(4);
}
}
// GOV.UK Publishing components button styles (inherits from GOV.UK Frontend button)
// https://github.com/alphagov/govuk_publishing_components/blob/master/app/assets/stylesheets/govuk_publishing_components/components/_button.scss
.notify-cookie-banner-button {
margin-bottom: govuk-spacing(1);
vertical-align: top;
@include govuk-media-query($from: desktop) {
vertical-align: baseline;
margin-right: govuk-spacing(2);
}
}
// Additions
// Override margin-bottom, inherited from using .govuk-body class
.notify-cookie-banner__confirmation-message {
margin-bottom: 0;
}