Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
esens-bob committed Dec 11, 2020
1 parent 38ccf35 commit 935ff83
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ You can use the following options.
`cookieDays` default: 365 // Amount of days the cookie is saved before erased by the browser.
`classPrefix` default: "AMPEr" // If you want to use you own styling.
`debugMode` default: false // Change this to true if you want to open the modal every pageload.
`extraClass` default: "" // Put an extra class for styling on the modal
`language` default: "en" // What language from the lexicon we want to use.
`lexicon` // see below for more information.
`analyticCallback` default: `function () { console.log("Consent for analytic cookies!");` // Triggers when it has consent for analytic cookies.
Expand Down
42 changes: 42 additions & 0 deletions dist/AMPEr/css/AMPEr.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* 4. Buttons and icon's
* 5. Toggle switch component
* 6. Transition
* 7. Extra styling options
*/
/* 2. Helpers ( Maybe this is already included, but heck .. )*/
.sr-only {
Expand Down Expand Up @@ -205,3 +206,44 @@ html.using-mouse :focus + label span:last-child {
display: none; }
#AMPEr_modal_2.AMPEr--active {
display: block; }

/* 7. Extra styling options */
.AMPEr_modal.AMPEr--bottom {
bottom: 0;
left: 0;
right: 0;
width: 100%;
border-radius: 0; }
.AMPEr_modal.AMPEr--bottom #AMPEr_modal_1 {
align-items: center;
justify-content: space-between; }
.AMPEr_modal.AMPEr--bottom #AMPEr_modal_1.AMPEr--active {
display: flex; }
.AMPEr_modal.AMPEr--bottom #AMPEr_modal_1 .AMPEr_modal_head {
display: none; }
.AMPEr_modal.AMPEr--bottom #AMPEr_modal_1 .AMPEr_description {
flex-grow: 1; }
.AMPEr_modal.AMPEr--bottom #AMPEr_modal_1 .AMPEr_modal_buttons {
margin-top: 0;
display: flex;
justify-content: flex-end;
min-width: 200px; }
.AMPEr_modal.AMPEr--bottom #AMPEr_modal_2 {
background-color: white;
padding: 1rem;
border-radius: 0.625rem;
max-width: 700px;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%); }
@media screen and (max-width: 768px) {
.AMPEr_modal.AMPEr--bottom #AMPEr_modal_1 {
flex-wrap: wrap; }
.AMPEr_modal.AMPEr--bottom #AMPEr_modal_1 .AMPEr_description {
flex-grow: 1; }
.AMPEr_modal.AMPEr--bottom #AMPEr_modal_1 .AMPEr_modal_buttons {
width: 100%;
margin-top: 0;
display: flex;
justify-content: flex-end; } }
Expand Down
3 changes: 2 additions & 1 deletion dist/AMPEr/js/AMPEr.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ var AMPEr = function () {
cookieName: "AMPEr",
cookieDays: 365,
classPrefix: "AMPEr",
extraClass: "",
debugMode: false,
language: "en",
lexicon: {
Expand Down Expand Up @@ -95,7 +96,7 @@ var AMPEr = function () {

var showCookieWindow = function showCookieWindow() {
var html;
html = '<div class="' + settings.classPrefix + '_modal" id="AMPEr_Cookies" role="dialog" aria-labelledby="AMPEr_title" aria-describedby="AMPEr_description">';
html = '<div class="' + settings.classPrefix + '_modal ' + settings.extraClass + '" id="AMPEr_Cookies" role="dialog" aria-labelledby="AMPEr_title" aria-describedby="AMPEr_description">';
html += '<div class="' + settings.classPrefix + '_modal_inner">';
html += '<div id="AMPEr_modal_1" class="AMPEr--active">';
html += '<h2 class="' + settings.classPrefix + '_modal_head" id="AMPEr_title">' + settings.lexicon[settings.language].modalTitle + '</h2>';
Expand Down
1 change: 1 addition & 0 deletions dist/js/build/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ function main() {
a11yFocus();
AMPEr.init({
debugMode: true,
extraClass: "AMPEr--bottom",
language: "en"
});
}
Expand Down
1 change: 1 addition & 0 deletions dist/js/main-concat.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/AMPEr/js/AMPEr.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ var AMPEr = (function () {
cookieName: "AMPEr",
cookieDays: 365,
classPrefix: "AMPEr",
extraClass: "",
debugMode: false,
language: "en",
lexicon: {
Expand Down Expand Up @@ -99,7 +100,7 @@ var AMPEr = (function () {
const showCookieWindow = function () {
let html;

html = '<div class="' + settings.classPrefix + '_modal" id="AMPEr_Cookies" role="dialog" aria-labelledby="AMPEr_title" aria-describedby="AMPEr_description">';
html = '<div class="' + settings.classPrefix + '_modal '+ settings.extraClass + '" id="AMPEr_Cookies" role="dialog" aria-labelledby="AMPEr_title" aria-describedby="AMPEr_description">';
html += '<div class="' + settings.classPrefix + '_modal_inner">';
html += '<div id="AMPEr_modal_1" class="AMPEr--active">';
html += '<h2 class="' + settings.classPrefix + '_modal_head" id="AMPEr_title">' + settings.lexicon.[settings.language].modalTitle + '</h2>'
Expand Down
63 changes: 63 additions & 0 deletions src/AMPEr/scss/AMPEr.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* 4. Buttons and icon's
* 5. Toggle switch component
* 6. Transition
* 7. Extra styling options
*/

// 1. Variables and functions
Expand Down Expand Up @@ -87,6 +88,8 @@ html.using-mouse :focus + label span:last-child {
&_text {
margin: 1rem 0;
}


}

@media screen and (min-width:480px){
Expand Down Expand Up @@ -306,3 +309,63 @@ html.using-mouse :focus + label span:last-child {
display: block;
}
}

/* 7. Extra styling options */
.AMPEr_modal.AMPEr--bottom {
bottom: 0;
left: 0;
right: 0;
width: 100%;
border-radius: 0;

#AMPEr_modal_1 {
&.AMPEr--active {
display:flex;
}
align-items: center;
justify-content: space-between;

.AMPEr_modal_head {
display: none;
}
.AMPEr_description {
flex-grow: 1;
}
.AMPEr_modal_buttons {
margin-top: 0;
display: flex;
justify-content: flex-end;
min-width: 200px;
}
}

#AMPEr_modal_2 {
background-color: white;
padding: 1rem;
border-radius: rem(10px);
max-width:700px;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}

@media screen and (max-width: 768px){
#AMPEr_modal_1 {
flex-wrap: wrap;

.AMPEr_description {
flex-grow: 1;
}
.AMPEr_modal_buttons {
width: 100%;
margin-top: 0;
display: flex;
justify-content: flex-end;
}
}
}



}
1 change: 1 addition & 0 deletions src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ function main() {

AMPEr.init({
debugMode: true,
extraClass: "AMPEr--bottom",
language: "en",
});
}
Expand Down

0 comments on commit 935ff83

Please sign in to comment.