From b0f41a353f20ab74870469af77bf2cae9af2e627 Mon Sep 17 00:00:00 2001 From: Jake Causier Date: Thu, 28 Jan 2021 16:26:34 +0000 Subject: [PATCH] Add option to wrap in a container --- admin/settings.php | 7 +++++++ css/cookie-notice.css | 25 +++++++++++++++++++++++++ includes/cookie-notice.php | 6 ++++++ 3 files changed, 38 insertions(+) diff --git a/admin/settings.php b/admin/settings.php index 4935b9f..f9fbd02 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -66,6 +66,13 @@ function scn_cookie_notice_settings_metabox() 'type' => 'text_url', ) ); + $cmb_options->add_field( array( + 'name' => __( 'Wrap content in container?', 'scn' ), + 'desc' => __( '

When enabled, content will be wrapped in a container as not to touch the edges of the screen. Useful to avoid conflicts with elements that attach to the screen edge.

', 'scn' ), + 'id' => 'cookie_notice_use_container', + 'type' => 'checkbox', + ) ); + $cmb_options->add_field( array( 'name' => 'Style', 'desc' => 'Change these settings to match your site theme.', diff --git a/css/cookie-notice.css b/css/cookie-notice.css index 6cfb404..311ff85 100644 --- a/css/cookie-notice.css +++ b/css/cookie-notice.css @@ -8,6 +8,9 @@ width: 100%; height: auto; } +#cookie-notice .scn-wrapper-container { + margin: 0 auto; +} #cookie-notice p { margin: 0; padding: 0; @@ -34,6 +37,7 @@ cursor: pointer; margin: 0 0.5rem; padding: 0.5rem 0.75rem; + white-space: nowrap; background-color: #FFFFFF; color: #000000; transition: all 150ms; @@ -43,6 +47,27 @@ background-color: #EEEEEE; transition: all 150ms; } +@media only screen and (min-width: 768px) { + #cookie-notice .scn-wrapper-container { + padding: 0 1rem; + max-width: 640px; + } +} +@media only screen and (min-width: 896px) { + #cookie-notice .scn-wrapper-container { + max-width: 768px; + } +} +@media only screen and (min-width: 1152px) { + #cookie-notice .scn-wrapper-container { + max-width: 1024px; + } +} +@media only screen and (min-width: 1408px) { + #cookie-notice .scn-wrapper-container { + max-width: 1280px; + } +} @media only screen and (max-width: 1023px) { #cookie-notice .scn-container { flex-flow: row wrap; diff --git a/includes/cookie-notice.php b/includes/cookie-notice.php index 5f55289..a295506 100644 --- a/includes/cookie-notice.php +++ b/includes/cookie-notice.php @@ -1,4 +1,7 @@