From ccd1ab1e9dcd8aee72e5004388f521f263cd9663 Mon Sep 17 00:00:00 2001 From: Marcin Orlowski Date: Tue, 30 Dec 2025 14:10:42 +0100 Subject: [PATCH 1/3] Added close action button --- .gitignore | 2 + Resources/public/devbar.css | 1 + Resources/views/devbar.html.twig | 80 +++++++++++++++++++------------- src/Dto/Widget.php | 7 ++- 4 files changed, 56 insertions(+), 34 deletions(-) diff --git a/.gitignore b/.gitignore index c976a09..e5f92a9 100644 --- a/.gitignore +++ b/.gitignore @@ -62,3 +62,5 @@ node_modules/ .local composer.lock + +.claude/ diff --git a/Resources/public/devbar.css b/Resources/public/devbar.css index 7413bb4..84a2223 100644 --- a/Resources/public/devbar.css +++ b/Resources/public/devbar.css @@ -199,3 +199,4 @@ body:has(.disco-devbar) #flash-messages { body.page-login:has(.disco-devbar) #flash-messages { top: 40px; /* Height of DiscoDevBar */ } + diff --git a/Resources/views/devbar.html.twig b/Resources/views/devbar.html.twig index 00a0faa..2b9d2e9 100644 --- a/Resources/views/devbar.html.twig +++ b/Resources/views/devbar.html.twig @@ -30,23 +30,31 @@ {% if not loop.first %} · {% endif %} - - - - {% if widget.icon %} - {% if widget.iconType.value == 'fa' %} - - {% else %} - {{ widget.icon }} + {% if widget.type == 'close' %} + + + + + + {% else %} + + + + {% if widget.icon %} + {% if widget.iconType.value == 'fa' %} + + {% else %} + {{ widget.icon }} + {% endif %} {% endif %} - {% endif %} - {% if widget.text %}{{ widget.text }}{% endif %} - - - + {% if widget.text %}{{ widget.text }}{% endif %} + + + + {% endif %} {% endfor %} {% endif %} diff --git a/src/Dto/Widget.php b/src/Dto/Widget.php index 761dbec..8172337 100644 --- a/src/Dto/Widget.php +++ b/src/Dto/Widget.php @@ -29,7 +29,8 @@ public function __construct( public readonly string $target, public readonly string $title, public readonly bool $expand, - public readonly IconType $iconType = IconType::FONT_AWESOME + public readonly IconType $iconType = IconType::FONT_AWESOME, + public readonly string $type = 'link' ) { } @@ -47,6 +48,7 @@ public static function fromArray(array $data): self $title = $data['title'] ?? ''; $expand = $data['expand'] ?? false; $iconType = $data['icon_type'] ?? 'fa'; + $type = $data['type'] ?? 'link'; return new self( icon: \is_string($icon) ? $icon : '', @@ -55,7 +57,8 @@ public static function fromArray(array $data): self target: \is_string($target) ? $target : '', title: \is_string($title) ? $title : '', expand: \is_bool($expand) ? $expand : false, - iconType: IconType::tryFrom(\is_string($iconType) ? $iconType : 'fa') ?? IconType::FONT_AWESOME + iconType: IconType::tryFrom(\is_string($iconType) ? $iconType : 'fa') ?? IconType::FONT_AWESOME, + type: \is_string($type) ? $type : 'link' ); } } From 78002849d5999639096497dfdf975cb014ff529d Mon Sep 17 00:00:00 2001 From: Marcin Orlowski Date: Tue, 30 Dec 2025 14:13:42 +0100 Subject: [PATCH 2/3] #33 Add close widget type to dismiss devbar --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f8a879a..1483bf3 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,7 @@ Example configuration that produces devbar shown in the screenshot above: ```yaml widgets: left: + - type: close - icon: "fa-bug" text: "1.47" url: "https://github.com//issues?q=is%3Aissue%20state%3Aopen%20milestone%3A1.47" @@ -122,6 +123,7 @@ widgets: | Property | Type | Required | Description | |-------------|:--------:|:--------:|--------------------------------------------------------------------------------| +| `type` | `string` | | Widget type: `link` (default) or `close` (dismisses devbar). | | `icon`* | `string` | | Optional icon to display. Can be Font Awesome class or emoji/text. | | `icon_type` | `string` | | Icon type: `fa` (Font Awesome, default) or `text` (emoji/plain text). | | `text`* | `string` | | Optional widget label to display alongside icon. | From 7cf04d6e0462f69e16c44115a12dfb8b556e9374 Mon Sep 17 00:00:00 2001 From: Marcin Orlowski Date: Tue, 30 Dec 2025 14:14:48 +0100 Subject: [PATCH 3/3] #33 Update changelog --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 77baa24..2e3d530 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,7 @@ ## 1.5.2 (2025-12-12) +- [#033] Added close widget type to dismiss devbar - [#027] Devbar template now includes its own CSS for self-contained styling - [#029] Normalized uses CSS styles in both views