Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeWithDennis committed Jun 27, 2024
1 parent 325cec1 commit 7b197d7
Showing 1 changed file with 54 additions and 24 deletions.
78 changes: 54 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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(),
Expand All @@ -92,7 +120,9 @@ SimpleAlertEntry::make()
### Example

```php
SimpleAlertEntry::make()
use CodeWithDennis\SimpleAlert\Components\Infolists\SimpleAlert;

SimpleAlert::make()
->success()
->title(new HtmlString('<strong>Hoorraayy! Your request has been approved! 🎉</strong>'))
->description('Lorem ipsum dolor sit amet consectetur adipisicing elit.')
Expand Down

0 comments on commit 7b197d7

Please sign in to comment.