kravcik / nette-macro-fontawesome
Simple macro for Nette framework, which allow short entry of font-awesome icons.
Installs: 8 583
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 2
Open Issues: 1
Requires
- php: ^8.0
- latte/latte: >2 <3
- nette/utils: ^3
Requires (Dev)
- modul-is/coding-standard: v3.x-dev
- nette/tester: *
- phpstan/phpstan: ^0.12
- phpstan/phpstan-nette: ^0.12
- tracy/tracy: *
Suggests
- kravcik/latte-font-awesome-icon: For Latte 3 you should upgrade to another package 'kravcik/latte-font-awesome-icon'
README
This repo is discontinued - for Latte3 and PHP8.1 you should look here: https://github.com/kravcik/latte-font-awesome-icon
Simple macro for generating Font Awesome icons. First parameter is required. Parameters can be set in order or randomly with string keys (macro detects if it's getting an associative array).
Version 2.0.0
It's compatible with FontAwesome 5, but default style is set to light
. Best option would be to create multiple macros or a static variable to set default style. Send me a PR or create an issue if you need this.
Thanks to @peldax it's also possible to change the html element. Default is span.
Register to config.neon
latte:
macros:
- Kravcik\Macros\FontAwesomeMacro::install
Parameters
icon
- icon name withoutfa-
color
- color (blue, red-dark, etc.)size
- number (generatesfa-{size}x
) or sm, lg, etc.fw
- if TRUE, disablefa-fw
style
-fas
/far
/fal
/fab
Examples
{icon star, 'el' => 'i'}
-> <i class="fal fa-star fa-fw"></i>
{icon star}
-> <span class="fal fa-star fa-fw"></span>
{icon star, red}
-> <span class="fal fa-star color-red fa-fw"></span>
{icon star, NULL, lg}
-> <span class="fal fa-star fa-lg fa-fw"></span>
{icon star, yellow, 2}
-> <span class="fal fa-star color-yellow fa-2x fa-fw"></span>
{icon star, blue, 2, TRUE, far}
-> <span class="far fa-star color-blue fa-2x"></span>
{icon star, size => 2, fw => TRUE, color => 'green-light', style => 'fas'}
-> <span class="fas fa-star color-green-light fa-2x"></span>