Skip to content

Commit 558658d

Browse files
committed
Merge branch 'release/1.8.6'
2 parents 199186b + 58253ae commit 558658d

File tree

7 files changed

+86
-31
lines changed

7 files changed

+86
-31
lines changed

changelog.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
# Changelog
22

33
All notable changes to `Cookie Consent package` will be documented in this file.
4+
## 1.8.6
5+
- Updated readme
6+
## 1.8.5
7+
- Styling updates
8+
## 1.8.4
9+
- Styling updates
10+
## 1.8.3
11+
- Styling updates
12+
## 1.8.2
13+
- Styling updates
414
## 1.8.1
515
- Fixed typo in js
616
## 1.8.0

public/css/cookie-consent.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/js/cookie-consent.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

readme.md

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,44 +59,52 @@ The javascript file is included in the cookie snippet and will be added at the e
5959

6060
Instead of including a snippet in your view, we will automatically add it. This is done using middleware using two methods:
6161

62-
1. The first option: include it in your entire project using the kernel:
62+
__For Laravel 11.x and newer__
6363

6464
```php
65-
// app/Http/Kernel.php
65+
// bootstrap/app.php
6666

67-
class Kernel extends HttpKernel
68-
{
69-
protected $middleware = [
70-
// ...
67+
->withMiddleware(function (Middleware $middleware) {
68+
...
69+
$middleware->web(append: [
70+
...
7171
\Statikbe\CookieConsent\CookieConsentMiddleware::class,
72-
];
72+
]);
7373

74-
// ...
75-
}
76-
```
74+
// OR AS AN ALIAS
75+
76+
$middleware->alias([
77+
...
78+
'cookie-consent' => \Statikbe\CookieConsent\CookieConsentMiddleware::class,
79+
]);
80+
})
7781

78-
2. The second option: include it as a route middleware and add this to any route you want.
82+
```
83+
__For Laravel 10.x and earlier__
7984

8085
```php
8186
// app/Http/Kernel.php
8287

8388
class Kernel extends HttpKernel
8489
{
85-
// ...
86-
87-
protected $routeMiddleware = [
90+
protected $middleware = [
8891
// ...
89-
'cookie-consent' => \Statikbe\CookieConsent\CookieConsentMiddleware::class,
92+
\Statikbe\CookieConsent\CookieConsentMiddleware::class,
9093
];
91-
}
92-
9394

95+
protected $routeMiddleware = [
96+
// ...
97+
'cookie-consent' => \Statikbe\CookieConsent\CookieConsentMiddleware::class,
98+
];
99+
100+
94101
// routes/web.php
95102
Route::group([
96103
'middleware' => ['cookie-consent']
97104
], function(){
98105
// ...
99106
});
107+
}
100108
```
101109

102110
This will add `cookieConsent::index` to the content of your response right before the closing body tag.

resources/js/util/modals.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@ function fadeBackdrop() {
4242
const backdropElement = document.querySelector('.js-lcc-backdrop');
4343

4444
if (isHidden(backdropElement)) {
45+
document.querySelector('html').classList.add('js-lcc-active');
4546
showElement(backdropElement);
4647
backdropElement.style.opacity = '1';
4748
} else {
48-
49+
document.querySelector('html').classList.remove('js-lcc-active');
4950
backdropElement.addEventListener('transitionend', hideBackdrop);
5051
backdropElement.style.opacity = '0';
5152
}
@@ -55,5 +56,5 @@ function fadeBackdrop() {
5556
hideElement(backdropElement);
5657

5758
backdropElement.removeEventListener('transitionend', hideBackdrop);
58-
};
59+
}
5960
}

resources/sass/cookie-consent.scss

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
/* Basic styling */
2+
.js-lcc-active {
3+
overflow: hidden;
4+
}
25

36
[class^="lcc-"] {
47
box-sizing: border-box !important;
@@ -44,7 +47,6 @@
4447
background-color: #111;
4548
color: white;
4649
border: 1px solid #111;
47-
outline: none;
4850
font-size: inherit;
4951
padding: 6px 15px;
5052
cursor: pointer;
@@ -56,8 +58,32 @@
5658

5759
&:hover,
5860
&:focus {
59-
background: #777;
60-
border-color: #777;
61+
background: #555;
62+
border-color: #555;
63+
}
64+
}
65+
66+
.lcc-button.lcc-button--ghost {
67+
68+
display: inline-block;
69+
background: transparent;
70+
background-color: transparent;
71+
color: black;
72+
border: 1px solid #111;
73+
font-size: inherit;
74+
padding: 6px 15px;
75+
cursor: pointer;
76+
margin: 1px 0;
77+
transition:
78+
color 0.2s ease,
79+
background-color 0.2s ease,
80+
border-color 0.2s ease;
81+
82+
&:hover,
83+
&:focus {
84+
color: white;
85+
background: #555;
86+
border-color: #555;
6187
}
6288
}
6389

@@ -89,6 +115,7 @@
89115
margin-bottom: 5px;
90116
display: flex;
91117
align-items: baseline;
118+
font-weight: 600;
92119

93120
&[for] {
94121
cursor: pointer;
@@ -102,7 +129,7 @@
102129
input[id^="lcc-"]:disabled {
103130

104131
cursor: default;
105-
color: #777;
132+
color: #555;
106133
opacity: .55;
107134

108135
& + span {
@@ -157,7 +184,7 @@ input[id^="lcc-"]:disabled {
157184

158185
&:hover,
159186
&:focus {
160-
color: #777;
187+
color: #555;
161188
}
162189
}
163190

@@ -168,12 +195,21 @@ input[id^="lcc-"]:disabled {
168195

169196
.lcc-modal__section {
170197
margin-bottom: 20px;
198+
199+
& .lcc-text {
200+
margin-left: 24px;
201+
}
171202
}
172203

173204
.lcc-modal__actions {
174205
margin-top: 30px;
175206
}
176207

208+
.lcc-modal__actions-center {
209+
display: flex;
210+
justify-content: center;
211+
}
212+
177213
.lcc-modal__actions > * {
178214
display: block;
179215
margin-top: 8px;

resources/views/index.blade.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ class="lcc-modal lcc-modal--alert js-lcc-modal js-lcc-modal-alert" style="displa
2626
<button type="button" class="lcc-button js-lcc-accept">
2727
@lang('cookie-consent::texts.alert_accept')
2828
</button>
29-
<button type="button" class="lcc-button lcc-button--link js-lcc-essentials">
29+
<button type="button" class="lcc-button js-lcc-essentials">
3030
@lang('cookie-consent::texts.alert_essential_only')
3131
</button>
32-
<button type="button" class="lcc-button lcc-button--link js-lcc-settings-toggle">
32+
<button type="button" class="lcc-button lcc-button--ghost js-lcc-settings-toggle">
3333
@lang('cookie-consent::texts.alert_settings')
3434
</button>
3535
</div>
@@ -66,8 +66,8 @@ class="lcc-modal lcc-modal--alert js-lcc-modal js-lcc-modal-alert" style="displa
6666
</p>
6767
</div>
6868
<div class="lcc-modal__section">
69-
<label for="lcc-checkbox-funtcional" class="lcc-label">
70-
<input type="checkbox" id="lcc-checkbox-funtcional" disabled="disabled" checked="checked">
69+
<label for="lcc-checkbox-functional" class="lcc-label">
70+
<input type="checkbox" id="lcc-checkbox-functional" disabled="disabled" checked="checked">
7171
<span>@lang('cookie-consent::texts.setting_functional')</span>
7272
</label>
7373
<p class="lcc-text">
@@ -94,7 +94,7 @@ class="lcc-modal lcc-modal--alert js-lcc-modal js-lcc-modal-alert" style="displa
9494
</div>
9595
</div>
9696
</div>
97-
<div class="lcc-modal__actions">
97+
<div class="lcc-modal__actions lcc-modal__actions-center">
9898
<button type="button" class="lcc-button js-lcc-settings-save">
9999
@lang('cookie-consent::texts.settings_save')
100100
</button>

0 commit comments

Comments
 (0)