Skip to content

Commit

Permalink
Merge branch 'main' of github.com-journey:rhiannonjourney/filament-st…
Browse files Browse the repository at this point in the history
…icky-resource-form-footers
  • Loading branch information
rhiannonjourney committed Nov 3, 2023
2 parents c5dd940 + f76eed9 commit eb8de77
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 28 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
72 changes: 44 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit eb8de77

Please sign in to comment.