Skip to content

Commit

Permalink
Update cookie consent library to 3.0.0-rc14. (NatLibFi#2909)
Browse files Browse the repository at this point in the history
This should fix functionality e.g. with older Safari versions.
The less files have been recreated to resemble the scss structure used in the library, and they are no longer so heavily modified for Bootstrap.
  • Loading branch information
EreMaijala committed May 30, 2023
1 parent 2e73ae8 commit 9899913
Show file tree
Hide file tree
Showing 23 changed files with 1,436 additions and 917 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@
"grunt-contrib-watch": "^1.1.0",
"jshint": "^2.13.4",
"jstree": "3.3.15",
"vanilla-cookieconsent": "3.0.0-rc.13"
"vanilla-cookieconsent": "3.0.0-rc.14"
}
}
2 changes: 1 addition & 1 deletion themes/bootprint3/css/compiled.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion themes/bootstrap3/css/compiled.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions themes/bootstrap3/js/vendor/cookieconsent.umd.js

Large diffs are not rendered by default.

7 changes: 2 additions & 5 deletions themes/bootstrap3/less/bootstrap.less
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $fa-font-path: "../../bootstrap3/css/fonts";
@import "components/alphabrowse";
@import "components/autocomplete";
@import "components/channels";
@import "components/cookie-consent";
@import "components/cookie-consent/index";
@import "components/devtools";
@import "components/form";
@import "components/icons";
Expand Down Expand Up @@ -496,14 +496,11 @@ div.holding-notes {
}

/* --- Cookie Consent --- */
.disable--interaction #cc-main .cm-wrapper::before,
.show--preferences #cc-main .cc--anim.pm-wrapper::before {
.show--preferences #cc-main .cc--anim .pm-overlay {
opacity: @modal-backdrop-opacity;
}

#cc-main {
z-index: @zindex-cookie-consent !important;

a {
&:hover {
color: @link-hover-color;
Expand Down
137 changes: 0 additions & 137 deletions themes/bootstrap3/less/components/cookie-consent.less

This file was deleted.

9 changes: 9 additions & 0 deletions themes/bootstrap3/less/components/cookie-consent/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
These files have been converted from orestbida/cookieconsent/src/scss with the following changes:

- Underscores have been removed from file names
- Variables in core/base.less and abstracts/light-color-scheme.less get their values from Bootstrap variables
- cc- prefix has been added to variables that were not prefixed
- `$` in variable names has been replaced with `@`
- Line feeds have been added in the end of each file
- `#{$cc-btn-height}` has been replaced with `@cc-btn-height`
- reset has been omitted so that e.g. link style remains correct
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/** Light color-scheme **/
:root{
--cc-bg: @modal-content-bg;
--cc-primary-color: @text-color;
--cc-secondary-color: lighten(@text-color, 10%);;

--cc-btn-primary-bg: @btn-primary-bg;
--cc-btn-primary-color: @btn-primary-color;
--cc-btn-primary-border-color: @btn-primary-bg;
--cc-btn-primary-hover-bg: @btn-primary-color;
--cc-btn-primary-hover-color: @btn-primary-bg;
--cc-btn-primary-hover-border-color: darken(@btn-primary-border, 12%);

--cc-btn-secondary-bg: @btn-default-bg;
--cc-btn-secondary-color: @btn-default-color;
--cc-btn-secondary-border-color: @btn-default-border;
--cc-btn-secondary-hover-bg: @btn-default-color;
--cc-btn-secondary-hover-color: @btn-default-bg;
--cc-btn-secondary-hover-border-color: darken(@btn-default-border, 12%);

--cc-separator-border-color: @well-border;

--cc-toggle-on-bg: @gray-light;
--cc-toggle-off-bg: lighten(@gray-light, 10%);
--cc-toggle-on-knob-bg: @body-bg;
--cc-toggle-off-knob-bg: @body-bg;

--cc-toggle-enabled-icon-color: @modal-content-bg; // yes (v tick)
--cc-toggle-disabled-icon-color: @modal-content-bg; // no (x tick)

--cc-toggle-readonly-bg: lighten(@gray-light, 20%);
--cc-toggle-readonly-knob-bg: @body-bg;
--cc-toggle-readonly-knob-icon-color: lighten(@gray-light, 20%);

--cc-section-category-border: @gray-lighter;

--cc-cookie-category-block-bg: @gray-lighter;
--cc-cookie-category-block-border: @list-group-border;
--cc-cookie-category-block-hover-bg: darken(@gray-lighter, 10%);
--cc-cookie-category-block-hover-border: @list-group-border;
--cc-cookie-category-expanded-block-bg: @gray-lighter;
--cc-cookie-category-expanded-block-hover-bg: darken(@gray-lighter, 10%);

--cc-overlay-bg: @modal-backdrop-bg;
--cc-webkit-scrollbar-bg: @gray-lighter;
--cc-webkit-scrollbar-hover-bg: @btn-primary-color;

--cc-footer-bg: @panel-footer-bg;
--cc-footer-color: @text-color;
--cc-footer-border-color: @panel-default-border;
}
119 changes: 119 additions & 0 deletions themes/bootstrap3/less/components/cookie-consent/core/base.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
@import "./global";

/**
* Global styles/variables
*/

:root{
--cc-font-family: @font-family-base;
--cc-modal-border-radius: @border-radius-base;
--cc-btn-border-radius: @btn-border-radius-base;
--cc-modal-transition-duration: .25s;
--cc-link-color: @link-color;
--cc-modal-margin: 1rem;
--cc-z-index: @zindex-cookie-consent;
}

#cc-main {

color: var(--cc-primary-color);
font-family: var(--cc-font-family);
font-size: 16px;
font-weight: 400;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizeLegibility;
position: relative;
line-height: 1.15;
-webkit-text-size-adjust: 100%;
z-index: var(--cc-z-index);
position: fixed;

&.cc--rtl{
direction: rtl;
}

b,
em,
strong,
a,
.cm__title{
font-weight: @cc-font-weight-bold;
}

button > span {
pointer-events: none;
}

a,
.cc__link{
font-weight: 600;
position: relative;
background-image: linear-gradient(currentColor, currentColor);
background-position: 0% 100%;
background-repeat: no-repeat;
background-size: 0% 1px;
transition: background-size .25s, color .25s ease;

&:hover{
color: var(--cc-primary-color);
background-size: 100% 1px;
}
}

.cc__link {
color: var(--cc-link-color);
}

/* Use Firefox's thin style scrollbar */
.cm__desc,
.pm__body{
scrollbar-width: thin;
overscroll-behavior: auto contain;
}

/* Show webkit's "cool" scrollbar only on non mobile screens */
@media screen and (min-width: 640px){

::-webkit-scrollbar,
::-webkit-scrollbar-track,
::-webkit-scrollbar-thumb{
all: revert;
}

::-webkit-scrollbar-thumb{
border: .25em solid var(--cc-bg);
-webkit-background-clip: padding-box;
background-clip: padding-box;
border-radius: 1em;
background: var(--cc-toggle-readonly-bg);

&:hover {
background: var(--cc-toggle-off-bg);
}
}

::-webkit-scrollbar {
background: transparent;
width: 12px;
}

}
}

/** Disable page scroll **/
html.disable--interaction{

&.show--consent,
&.show--consent body{
height: auto!important;
overflow: hidden!important;
}
}

// disable transition if prefers-reduced-motion detected
@media (prefers-reduced-motion) {
#cc-main {
--cc-modal-transition-duration: 0s;
}
}
Loading

0 comments on commit 9899913

Please sign in to comment.