Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions assets/icons/symfony.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"symfony/stopwatch": "^6.4",
"symfony/translation": "^6.4",
"symfony/twig-bundle": "^6.4",
"symfony/ux-icons": "^2.32",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be in the project require, but from kevinpapst/tabler-bundle require that himsefl requires symfony/ux-icons.
To fix when kevinpapst/TablerBundle#195 is merged

"symfony/validator": "^6.4",
"symfony/webpack-encore-bundle": "^2.0",
"symfony/yaml": "^6.4"
Expand Down
95 changes: 94 additions & 1 deletion composer.lock

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

1 change: 1 addition & 0 deletions config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
KevinPapst\TablerBundle\TablerBundle::class => ['all' => true],
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Symfony\UX\Icons\UXIconsBundle::class => ['all' => true],
];
22 changes: 22 additions & 0 deletions config/packages/ux_icons.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Full configuration reference: https://symfony.com/bundles/ux-icons/current/index.html#configuration
ux_icons:
aliases:
about: 'fa7-solid:info-circle'

# Default HTML attributes to add to all icons
default_icon_attributes:

# Use current text color to fill the icon
fill: currentColor

# Default dimensions
height: '1em'
width: '1em'

# Throw an exception if an icon is not
ignore_not_found: false

when@prod:
ux_icons:
# Suppress exceptions for missing icons in production
ignore_not_found: true
24 changes: 24 additions & 0 deletions src/Controller/AddonsController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

/*
* This file is part of the Tabler-Bundle demo.
* Copyright 2021 Kevin Papst - www.kevinpapst.de
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;

class AddonsController extends AbstractController
{
#[Route('/icons', name: 'icons')]
public function icons(): Response
{
return $this->render('addons/icons.html.twig');
}
}
8 changes: 7 additions & 1 deletion src/EventSubscriber/MenuBuilderSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static function getSubscribedEvents(): array
public function onSetupNavbar(MenuEvent $event): void
{
$event->addItem(
new MenuItemModel('homepage', 'homepage', 'homepage', [], 'fas fa-tachometer-alt')
new MenuItemModel('homepage', 'homepage', 'homepage', [], 'tabler:home')
);

$forms = new MenuItemModel('forms', 'Forms', null, [], 'fab fa-wpforms');
Expand Down Expand Up @@ -106,6 +106,12 @@ public function onSetupNavbar(MenuEvent $event): void
$docu->setBadgeColor('blue');
$event->addItem($docu);

$addons = new MenuItemModel('addons', 'Addons');
$addons->addChild(
new MenuItemModel('icons', 'Icons', 'icons')
);
$event->addItem($addons);

if (!$this->security->isGranted('IS_AUTHENTICATED')) {
$event->addItem(
new MenuItemModel('login', 'login', 'security_login', [], 'fas fa-sign-in-alt')
Expand Down
13 changes: 13 additions & 0 deletions symfony.lock
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,19 @@
"ref": "f75ac166398e107796ca94cc57fa1edaa06ec47f"
}
},
"symfony/ux-icons": {
"version": "2.32",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "2.19",
"ref": "c965ca0bf8a40e03420d57e08cff0bf6045e4ae7"
},
"files": [
"assets/icons/symfony.svg",
"config/packages/ux_icons.yaml"
]
},
"symfony/validator": {
"version": "5.4",
"recipe": {
Expand Down
53 changes: 53 additions & 0 deletions templates/addons/icons.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{% extends 'layout.html.twig' %}

{% block page_content %}
{% embed '@Tabler/embeds/card.html.twig' with {fullsize : false} %}
{% block box_title %}Interface icons{% endblock %}
{% block box_body %}
<div class="card">
<table class="table table-vcenter card-table">
<thead>
<tr>
<th>Type</th>
<th>Alias</th>
<th>Ux icon fullName</th>
<th>Fontawesome name</th>
<th>Fontawesome fullName</th>
</tr>
</thead>
<tbody>
<tr class="bg-primary-lt">
<td>Values</td>
<td><code>about</code></td>
<td><code>fa7-solid:info-circle</code></td>
<td><code>fa-info-circle</code></td>
<td><code>fas fa-info-circle</code></td>
</tr>
<tr>
<td>Ux icon</td>
<td>{{ ux_icon('about') }}</td>
<td>{{ ux_icon('fa7-solid:info-circle') }}</td>
<td></td>
<td></td>
</tr>
<tr>
<td>NEW tabler_icon</td>
<td>{{ tabler_icon('about', true) }}</td>
<td>{{ tabler_icon('fa7-solid:info-circle', true) }}</td>
<td>{{ tabler_icon('fa-info-circle', true) }}</td>
<td>{{ tabler_icon('fas fa-info-circle', true) }}</td>
</tr>
<tr>
<td>Manual</td>
<td>{{ ux_icon('tabler:forms') }}</td>
<td>{{ tabler_icon('forms') }}</td>
<td>{{ tabler_icon('tabler:forms') }}</td>
<td>{{ tabler_icon('tabler:forms', true) }}</td>
<td></td>
</tr>
</tbody>
</table>
</div>
{% endblock %}
{% endembed %}
{% endblock %}