From 7b197d7524cae5a2ae6ae21960aafa2ab8921bfb Mon Sep 17 00:00:00 2001 From: Dennis Elsinga Date: Thu, 27 Jun 2024 14:51:02 +0200 Subject: [PATCH] Update README --- README.md | 78 ++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 54 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index f0a5ad4..5207e96 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/codewithdennis/filament-simple-alert/fix-php-code-styling.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/codewithdennis/filament-simple-alert/actions?query=workflow%3A"Fix+PHP+code+styling"+branch%3Amain) [![Total Downloads](https://img.shields.io/packagist/dt/codewithdennis/filament-simple-alert.svg?style=flat-square)](https://packagist.org/packages/codewithdennis/filament-simple-alert) -This package provides a simple alert component for Filament. +This package provides a simple alert components for your Filament application. ## Installation @@ -16,74 +16,102 @@ composer require codewithdennis/filament-simple-alert ## Usage +The alerts can be used in your `infolists` or `forms`, make sure you pick the right component. + +```php +use CodeWithDennis\SimpleAlert\Components\Infolists\SimpleAlert; +``` + +```php +use CodeWithDennis\SimpleAlert\Components\Forms\SimpleAlert; +``` + ### Simple Alerts +There are 4 types of simple alerts: `danger`, `info`, `success`, and `warning`. + ```php -SimpleAlertEntry::make() +use CodeWithDennis\SimpleAlert\Components\Infolists\SimpleAlert; + +SimpleAlert::make() ->danger() ->info() ->success() ->warning() ``` -If you would like to use a [different color](https://filamentphp.com/docs/3.x/support/colors), you can use the `color` method: +If you would like to use a [different color](https://filamentphp.com/docs/3.x/support/colors), you can use the `color` method. ```php -SimpleAlertEntry::make() +use CodeWithDennis\SimpleAlert\Components\Infolists\SimpleAlert; + +SimpleAlert::make() ->color('purple') ``` -### Title +### Icon -You can add a title to the alert by using the `title` method: +By default, all simple alerts will have an icon. If you would like to change the icon, you can use the `icon` method. ```php -SimpleAlertEntry::make() - ->title('Hoorraayy! Your request has been approved! 🎉') +use CodeWithDennis\SimpleAlert\Components\Infolists\SimpleAlert; + +SimpleAlert::make() + ->color('purple') + ->icon('heroicon-s-users') ``` -### Description +### Title -You can add a description to the alert by using the `description` method: +You can add a title to the alert by using the `title` method. ```php -SimpleAlertEntry::make() - ->description('This is the description') +use CodeWithDennis\SimpleAlert\Components\Infolists\SimpleAlert; + +SimpleAlert::make() + ->title('Hoorraayy! Your request has been approved! 🎉') ``` -### Icon +### Description -By default, all simple alerts will have an icon. If you would like to change the icon, you can use the `icon` method: +You can add a description to the alert by using the `description` method. ```php -SimpleAlertEntry::make() - ->color('purple') - ->icon('heroicon-s-users') +use CodeWithDennis\SimpleAlert\Components\Infolists\SimpleAlert; + +SimpleAlert::make() + ->description('This is the description') ``` ### Link -You can also add a link to the alert by using the `link` method: +You can also add a link to the alert by using the `link` method. ```php -SimpleAlertEntry::make() +use CodeWithDennis\SimpleAlert\Components\Infolists\SimpleAlert; + +SimpleAlert::make() ->info() ->link('https://filamentphp.com'), ``` -If you would like the link to customize the link label, you can use the `linkLabel` method: +If you would like the link to customize the link label, you can use the `linkLabel` method. ```php -SimpleAlertEntry::make() +use CodeWithDennis\SimpleAlert\Components\Infolists\SimpleAlert; + +SimpleAlert::make() ->info() ->link('https://filamentphp.com') ->linkLabel('Read more!'), ``` -If you would like the link to open in a new tab, you can use the `blank` method: +If you would like the link to open in a new tab, you can use the `blank` method. ```php -SimpleAlertEntry::make() +use CodeWithDennis\SimpleAlert\Components\Infolists\SimpleAlert; + +SimpleAlert::make() ->info() ->link('https://filamentphp.com') ->linkBlank(), @@ -92,7 +120,9 @@ SimpleAlertEntry::make() ### Example ```php -SimpleAlertEntry::make() +use CodeWithDennis\SimpleAlert\Components\Infolists\SimpleAlert; + +SimpleAlert::make() ->success() ->title(new HtmlString('Hoorraayy! Your request has been approved! 🎉')) ->description('Lorem ipsum dolor sit amet consectetur adipisicing elit.')