Skip to content

Commit

Permalink
Merge branch 'v2'
Browse files Browse the repository at this point in the history
  • Loading branch information
johanrosenson committed Feb 9, 2023
2 parents 34bdc17 + 644676d commit f11e934
Show file tree
Hide file tree
Showing 22 changed files with 382 additions and 315 deletions.
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# Font Awesome Blade

Laravel [Blade Components](https://laravel.com/docs/8.x/blade#components) to make it dead simple to use Font Awesome SVG's in Laravel.
A collection of [Laravel Blade Components](https://laravel.com/docs/9.x/blade#components) to make it dead simple to use the [Font Awesome icons](https://fontawesome.com/v6/icons) in Laravel.

# Prerequisites

Expand All @@ -19,7 +19,9 @@ composer require devlop/fontawesome-blade

# Configuration

By default this package will assume you are using the Pro versions, if you are using the free versions you can change this in the configuration.
By default this package will assume you are using the `@fortawesome/fontawesome-free`.

If you are using any other version, publish the configuration and change the path accordingly.

```
php artisan vendor:publish --provider="Devlop\FontAwesome\FontAwesomeBladeServiceProvider"
Expand All @@ -30,20 +32,20 @@ php artisan vendor:publish --provider="Devlop\FontAwesome\FontAwesomeBladeServic
Each of Font Awesome's different styles are available as separate components, they all accept the same `name` argument for specifying which icon to display.

```html
<x-fa.brands name="fa-laravel" />
<x-fa::brands name="fa-laravel" />

<x-fa.solid name="fa-0" />
<x-fa::solid name="fa-0" />

<x-fa.regular name="fa-2" />
<x-fa::regular name="fa-2" />

<x-fa.light name="fa-5" />
<x-fa::light name="fa-5" />

<x-fa.thin name="fa-0" />
<x-fa::thin name="fa-0" />

<x-fa.duotone name="fa-elephant" />
<x-fa::duotone name="fa-elephant" />
```

You also need to import the Font Awesome styles into your SASS to get the icons to display identical to using the JS method.
You also need to import the Font Awesome CSS into your CSS build to get the icons to display like they would if you were using the Font Awesome JS method.

```scss
@import '@fortawesome/fontawesome-pro/css/svg-with-js.css';
Expand Down
6 changes: 6 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# From v1 to v2

- The config file have been renamed from `fontawesome-blade.php` to `fontawesome.php` (the old config file will still work until v3).
- The package config option have been renamed from `package` to `path`, and expects the full path to the /svgs folder, and not only to the package root (the old config option `package` will still work until v3).
- The blade components are now namespaced as `fa`, use `<x-fa::solid ...>` instead of the old `<x-fa.solid ...>` (the old component will still work until v3).
- The default path now refers to `@fortawesome/fontawesome-free` instead of `@fortawesome/fontawesome-pro`, publish the config to change to your package of choice.
10 changes: 0 additions & 10 deletions config/fontawesome-blade.php

This file was deleted.

10 changes: 10 additions & 0 deletions config/fontawesome.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

return [

/**
* The path to the Font Awesome icon set SVG's to use.
*/
'path' => base_path('node_modules/@fortawesome/fontawesome-free/svgs'),

];
12 changes: 9 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"private": true,
"devDependencies": {
"@fortawesome/fontawesome-pro": "6.0.0-beta1"
"@fortawesome/fontawesome-free": "^6.0.0",
"@fortawesome/fontawesome-pro": "^6.0.0"
}
}
20 changes: 20 additions & 0 deletions src/Components/Brands.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace Devlop\FontAwesome\Components;

use Devlop\FontAwesome\FontAwesomeBaseComponent;
use Illuminate\Contracts\View\View;
use Illuminate\View\Component;

final class Brands extends FontAwesomeBaseComponent
{
/**
* Create a new component instance.
*/
public function __construct(string $path, string $name)
{
parent::__construct($path, 'brands', $name);
}
}
20 changes: 20 additions & 0 deletions src/Components/Duotone.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace Devlop\FontAwesome\Components;

use Devlop\FontAwesome\FontAwesomeBaseComponent;
use Illuminate\Contracts\View\View;
use Illuminate\View\Component;

final class Duotone extends FontAwesomeBaseComponent
{
/**
* Create a new component instance.
*/
public function __construct(string $path, string $name)
{
parent::__construct($path, 'duotone', $name);
}
}
32 changes: 0 additions & 32 deletions src/Components/FaBrands.php

This file was deleted.

32 changes: 0 additions & 32 deletions src/Components/FaDuotone.php

This file was deleted.

32 changes: 0 additions & 32 deletions src/Components/FaLight.php

This file was deleted.

32 changes: 0 additions & 32 deletions src/Components/FaRegular.php

This file was deleted.

32 changes: 0 additions & 32 deletions src/Components/FaSolid.php

This file was deleted.

32 changes: 0 additions & 32 deletions src/Components/FaThin.php

This file was deleted.

20 changes: 20 additions & 0 deletions src/Components/Light.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace Devlop\FontAwesome\Components;

use Devlop\FontAwesome\FontAwesomeBaseComponent;
use Illuminate\Contracts\View\View;
use Illuminate\View\Component;

final class Light extends FontAwesomeBaseComponent
{
/**
* Create a new component instance.
*/
public function __construct(string $path, string $name)
{
parent::__construct($path, 'light', $name);
}
}
20 changes: 20 additions & 0 deletions src/Components/Regular.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace Devlop\FontAwesome\Components;

use Devlop\FontAwesome\FontAwesomeBaseComponent;
use Illuminate\Contracts\View\View;
use Illuminate\View\Component;

final class Regular extends FontAwesomeBaseComponent
{
/**
* Create a new component instance.
*/
public function __construct(string $path, string $name)
{
parent::__construct($path, 'regular', $name);
}
}
Loading

0 comments on commit f11e934

Please sign in to comment.