Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,24 @@ Cookie notices are boring and this package's default design is no different. It

However, this world shouldn't be a boring place and even if cookie notices are part of a project's legal requirements, why not use it as an opportunity to bring a smile to your audience's face? Cookie modals are now integrated in every digital platform's user experience and therefore they should blend in accordingly: that's why we've built this package with full flexibility in our mind.

For example, after publishing the views, you can fully customize the different buttons, as in this example:

```bladehtml
<form action="{!! $url !!}" {!! $attributes !!}>
@csrf
@if($action === 'reset')
<button type="submit" class="{!! $basename !!}__reset" data-toggle="tooltip">
<span class="icon icon--reset"></span>
<span class="{!! $basename !!}__label">{{ $label }}</span>
</button>
@else
<button type="submit" class="{!! $basename !!}__link">
<span class="{!! $basename !!}__label">{{ $label }}</span>
</button>
@endif
</form>
```

### The views

A good starting point is to take a look at this package's default markup. If not already published, you can access the views using `php artisan vendor:publish --tag=laravel-cookie-consent-views`, this will copy our blade files to your app's `resources/views/vendor/cookie-consent` directory.
Expand Down Expand Up @@ -373,7 +391,7 @@ Our CSS is compiled from a SASS file included in this package's `resources/scss`
Buttons in this package are designed to be easily customizable.
You can pass an array of attributes directly to the `@cookieconsentbutton` component:

```blade
```bladehtml
@cookieconsentbutton(
action: 'reset',
label: 'Manage cookies',
Expand All @@ -391,7 +409,7 @@ In this example:

With this setup, you can freely customize your button styles using pseudo-classes like `:hover`, `:focus`, while keeping a clean and maintainable structure.

For other changes, don't forget [you can publish the package views](#the-views).
For other changes, don't forget [you can publish the package views](#the-views). The `$action` variable lets you customize your button for specific use cases.

### Javascript

Expand Down
1 change: 1 addition & 0 deletions src/CookiesManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ public function renderButton(string $action, ?string $label = null, array $attri
'label' => $label ?? $action, // TODO: use lang file
'attributes' => $attributes,
'basename' => $basename,
'action' => $action,
])->render();
}

Expand Down