4 Commits

Author SHA1 Message Date
brabli f0730c268e Update to version 2.2.0 2026-05-06 12:34:52 +01:00
brabli f06dbf90bc Add semantic badge colours 2026-05-06 12:34:34 +01:00
brabli 44f878715b Fix grammar 2026-05-06 12:34:15 +01:00
brabli edb8a05bee Fix tag 2026-05-06 12:34:08 +01:00
4 changed files with 12 additions and 2 deletions
+4
View File
@@ -2,6 +2,10 @@
## [x.x.x] - xxxx-xx-xx ## [x.x.x] - xxxx-xx-xx
## [2.2.0] - 2026-05-05
- Add semantic badge colours (`SUCCESS`, `WARNING`, `DANGER`)
- Fix typos
## [2.1.0] - 2026-05-01 ## [2.1.0] - 2026-05-01
- Fix glossy badge border colour - Fix glossy badge border colour
- Change default badge style to be fully rounded - Change default badge style to be fully rounded
+1 -1
View File
@@ -116,7 +116,7 @@ obj="{{ job.kind }}"
<twig:Pcm:Badge colour="red" label="Warning!" /> <twig:Pcm:Badge colour="red" label="Warning!" />
<twig:Pcm:Badge colour="red">Warning!<twig:Pcm:Badge> <twig:Pcm:Badge colour="red">Warning!</twig:Pcm:Badge>
``` ```
<br> <br>
+6
View File
@@ -14,6 +14,7 @@ enum BadgeColour
case BLUE; case BLUE;
case BROWN; case BROWN;
case CYAN; case CYAN;
case DANGER;
case DEFAULT; case DEFAULT;
case EMERALD; case EMERALD;
case FOREST; case FOREST;
@@ -35,8 +36,10 @@ enum BadgeColour
case SLATE; case SLATE;
case STONE; case STONE;
case STRIPE; case STRIPE;
case SUCCESS;
case TEAL; case TEAL;
case VIOLET; case VIOLET;
case WARNING;
case YELLOW; case YELLOW;
case ZINC; case ZINC;
@@ -49,6 +52,7 @@ enum BadgeColour
$this::BLUE => new BadgePalette('text-blue-700', 'border-blue-700/30', 'bg-blue-700'), $this::BLUE => new BadgePalette('text-blue-700', 'border-blue-700/30', 'bg-blue-700'),
$this::BROWN => new BadgePalette('text-stone-700', 'border-stone-700/30', 'bg-stone-700'), $this::BROWN => new BadgePalette('text-stone-700', 'border-stone-700/30', 'bg-stone-700'),
$this::CYAN => new BadgePalette('text-cyan-600', 'border-cyan-600/30', 'bg-cyan-600'), $this::CYAN => new BadgePalette('text-cyan-600', 'border-cyan-600/30', 'bg-cyan-600'),
$this::DANGER => new BadgePalette('text-danger', 'border-danger/30', 'bg-danger'),
$this::DEFAULT => new BadgePalette('text-primary', 'border-primary/30', 'bg-primary'), $this::DEFAULT => new BadgePalette('text-primary', 'border-primary/30', 'bg-primary'),
$this::EMERALD => new BadgePalette('text-emerald-600', 'border-emerald-600/30', 'bg-emerald-600'), $this::EMERALD => new BadgePalette('text-emerald-600', 'border-emerald-600/30', 'bg-emerald-600'),
$this::FOREST => new BadgePalette('text-green-800', 'border-green-800/30', 'bg-green-800'), $this::FOREST => new BadgePalette('text-green-800', 'border-green-800/30', 'bg-green-800'),
@@ -70,8 +74,10 @@ enum BadgeColour
$this::SLATE => new BadgePalette('text-slate-600', 'border-slate-600/30', 'bg-slate-600'), $this::SLATE => new BadgePalette('text-slate-600', 'border-slate-600/30', 'bg-slate-600'),
$this::STONE => new BadgePalette('text-stone-500', 'border-stone-500/30', 'bg-stone-500'), $this::STONE => new BadgePalette('text-stone-500', 'border-stone-500/30', 'bg-stone-500'),
$this::STRIPE => new BadgePalette('text-indigo-500', 'border-indigo-500/30', 'bg-indigo-500'), $this::STRIPE => new BadgePalette('text-indigo-500', 'border-indigo-500/30', 'bg-indigo-500'),
$this::SUCCESS => new BadgePalette('text-success', 'border-success/30', 'bg-success'),
$this::TEAL => new BadgePalette('text-teal-600', 'border-teal-600/30', 'bg-teal-600'), $this::TEAL => new BadgePalette('text-teal-600', 'border-teal-600/30', 'bg-teal-600'),
$this::VIOLET => new BadgePalette('text-violet-600', 'border-violet-600/30', 'bg-violet-600'), $this::VIOLET => new BadgePalette('text-violet-600', 'border-violet-600/30', 'bg-violet-600'),
$this::WARNING => new BadgePalette('text-warning', 'border-warning/30', 'bg-warning'),
$this::YELLOW => new BadgePalette('text-yellow-600', 'border-yellow-600/30', 'bg-yellow-600'), $this::YELLOW => new BadgePalette('text-yellow-600', 'border-yellow-600/30', 'bg-yellow-600'),
$this::ZINC => new BadgePalette('text-zinc-500', 'border-zinc-500/30', 'bg-zinc-500'), $this::ZINC => new BadgePalette('text-zinc-500', 'border-zinc-500/30', 'bg-zinc-500'),
}; };
+1 -1
View File
@@ -54,7 +54,7 @@ final class Badge
$this->label = $label; $this->label = $label;
if (!$obj && !$colour) { if (!$obj && !$colour) {
throw new \RuntimeException(sprintf('You must specify either a colour an instance of "%s".', BadgeableInterface::class)); throw new \RuntimeException(sprintf('You must specify either a colour or an instance of "%s".', BadgeableInterface::class));
} }
if ($obj && $colour) { if ($obj && $colour) {