Add actual badge classes to bundle

This commit is contained in:
2024-08-08 14:15:09 +01:00
parent 8d85e6fa44
commit 36f3267fc6
5 changed files with 93 additions and 2 deletions

46
src/Enum/Badge.php Normal file
View File

@@ -0,0 +1,46 @@
<?php
declare(strict_types=1);
namespace Pcm\BadgeBundle\Enum;
use Pcm\BadgeBundle\Model\BadgePalette;
enum Badge
{
case AMBER;
case BLACK;
case BLUE;
case DEFAULT;
case FOREST;
case GREEN;
case GREY;
case MAROON;
case OCHRE;
case ORANGE;
case RED;
case ROSE;
case STRIPE;
case YELLOW;
public function getPalette(): BadgePalette
{
return match ($this) {
$this::RED => new BadgePalette('text-red-600', 'border-red-600', 'bg-red-600'),
$this::MAROON => new BadgePalette('text-red-900', 'border-red-900', 'bg-red-900'),
$this::BLUE => new BadgePalette('text-sky-700', 'border-sky-700', 'bg-sky-700'),
$this::FOREST => new BadgePalette('text-green-800', 'border-green-800', 'bg-green-800'),
$this::GREEN => new BadgePalette('text-green-600', 'border-green-600', 'bg-green-600'),
$this::OCHRE => new BadgePalette('text-yellow-800', 'border-yellow-800', 'bg-yellow-800'),
$this::ORANGE => new BadgePalette('text-orange-500', 'border-orange-500', 'bg-orange-500'),
$this::AMBER => new BadgePalette('text-amber-500', 'border-amber-500', 'bg-amber-500'),
$this::ROSE => new BadgePalette('text-rose-600', 'border-rose-600', 'bg-rose-600'),
$this::GREY => new BadgePalette('text-neutral-400', 'border-neutral-400', 'bg-neutral-400'),
$this::YELLOW => new BadgePalette('text-yellow-500', 'border-yellow-500', 'bg-yellow-500'),
$this::STRIPE => new BadgePalette('text-indigo-500', 'border-indigo-500', 'bg-indigo-500'),
$this::BLACK => new BadgePalette('text-zinc-100', 'border-zinc-900', 'bg-zinc-900'),
$this::DEFAULT => new BadgePalette('text-primary', 'border-primary', 'bg-primary'),
};
}
}