diff --git a/CHANGELOG.md b/CHANGELOG.md index 984a247..49892b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,18 @@ All notable changes to `filament-sticky-resource-form-footers` will be documented in this file. +## v1.0.1 - 2023-11-03 + +### What's Changed + +- Add missing Readme by @rhiannonjourney in https://github.com/rhiannonjourney/filament-sticky-resource-form-footers/pull/3 + +### New Contributors + +- @rhiannonjourney made their first contribution in https://github.com/rhiannonjourney/filament-sticky-resource-form-footers/pull/3 + +**Full Changelog**: https://github.com/rhiannonjourney/filament-sticky-resource-form-footers/compare/v1.0.0...v1.0.1 + ## v1.0.0 - 2023-11-03 Adds sticky footer to Filament resource forms. diff --git a/README.md b/README.md index 51842e2..253ac62 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,7 @@ [![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/unexpectedjourney/filament-sticky-resource-form-footers/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/unexpectedjourney/filament-sticky-resource-form-footers/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain) [![Total Downloads](https://img.shields.io/packagist/dt/unexpectedjourney/filament-sticky-resource-form-footers.svg?style=flat-square)](https://packagist.org/packages/unexpectedjourney/filament-sticky-resource-form-footers) - - -This is where your description should go. Limit it to a paragraph or two. Consider adding a small example. +Add sticky footers to the Creat/Edit pages of your Filament resources. Inspired heavily by https://github.com/awcodes/filament-sticky-header/. ## Installation @@ -17,43 +15,61 @@ You can install the package via composer: composer require unexpectedjourney/filament-sticky-resource-form-footers ``` -You can publish and run the migrations with: - -```bash -php artisan vendor:publish --tag="filament-sticky-resource-form-footers-migrations" -php artisan migrate -``` +## Usage -You can publish the config file with: +Just add the plugin to your panel provider, and you're good to go. -```bash -php artisan vendor:publish --tag="filament-sticky-resource-form-footers-config" +```php +use UnexpectedJourney\FilamentStickyResourceFormFooters\FilamentStickyResourceFormFootersPlugin; + +public function panel(Panel $panel): Panel +{ + return $panel + ->plugins([ + FilamentStickyResourceFormFootersPlugin::make(), + ]) + ]) +} ``` -Optionally, you can publish the views using +### Floating Theme -```bash -php artisan vendor:publish --tag="filament-sticky-resource-form-footers-views" -``` +To use the 'Floating Theme' use the `floating()` method when instantiating the plugin. -This is the contents of the published config file: +When using the floating theme you can also use the `colored()` method to add your primary background color to the footer. ```php -return [ -]; +use UnexpectedJourney\FilamentStickyResourceFormFooters\FilamentStickyResourceFormFootersPlugin; + + +public function panel(Panel $panel): Panel +{ + return $panel + ->plugins([ + FilamentStickyResourceFormFootersPlugin::make() + ->floating() + ->colored() + ]) + ]); +} ``` -## Usage +Both the `floating()` and `colored()` methods can receive closure that will be evaluated to determine if the theme should be applied. This allows you to apply the theme conditionally, for instance, based off of user preferences. ```php -$filamentStickyResourceFormFooters = new UnexpectedJourney\FilamentStickyResourceFormFooters(); -echo $filamentStickyResourceFormFooters->echoPhrase('Hello, UnexpectedJourney!'); -``` - -## Testing - -```bash -composer test +use UnexpectedJourney\FilamentStickyResourceFormFooters\FilamentStickyResourceFormFootersPlugin; + + +public function panel(Panel $panel): Panel +{ + return $panel + ->plugins([ + FilamentStickyResourceFormFootersPlugin::make() + ->floating(fn():bool => auth()->user()->use_floating_header) + ->colored(fn():bool => auth()->user()->use_floating_header) + ]) + ]); +} ``` ## Changelog