From c51509c11a0173a04b0fb23186ecb8fac5ca1b50 Mon Sep 17 00:00:00 2001 From: Marcin Orlowski Date: Tue, 30 Dec 2025 14:16:46 +0100 Subject: [PATCH 1/3] #33 Added close action button (#34) --- .gitignore | 2 + CHANGES.md | 1 + README.md | 2 + Resources/public/devbar.css | 1 + Resources/views/devbar.html.twig | 80 +++++++++++++++++++------------- src/Dto/Widget.php | 7 ++- 6 files changed, 59 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/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 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. | 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 f15e42212311bc9bc593c8c0249d50c32ac2d209 Mon Sep 17 00:00:00 2001 From: Marcin Orlowski Date: Tue, 30 Dec 2025 15:16:14 +0100 Subject: [PATCH 2/3] #35 BG strips color config (#36) --- CHANGES.md | 6 +++++- README.md | 9 +++++++++ Resources/public/devbar.css | 10 +++++----- Resources/views/devbar.html.twig | 2 +- src/Dto/DiscoDevBarData.php | 6 +++++- src/Service/DiscoDevBarService.php | 17 +++++++++++++++-- 6 files changed, 40 insertions(+), 10 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 2e3d530..58cef6b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,8 +1,12 @@ # Changelog -## 1.5.2 (2025-12-12) +## 1.6.0 (TBD) +- [#035] Added customizable background colors for breathing stripes - [#033] Added close widget type to dismiss devbar + +## 1.5.2 (2025-12-12) + - [#027] Devbar template now includes its own CSS for self-contained styling - [#029] Normalized uses CSS styles in both views diff --git a/README.md b/README.md index 1483bf3..57d63dc 100644 --- a/README.md +++ b/README.md @@ -208,6 +208,15 @@ Include the devbar template in your base layout: ## Customization +### Background Colors + +Customize the breathing stripes background colors in your `.disco-devbar.yaml`: + +```yaml +bg_color_light: '#b71c1c' +bg_color_dark: '#8e0000' +``` + ### Custom CSS The bundle includes default styling. To customize, override the CSS after importing bundle assets or diff --git a/Resources/public/devbar.css b/Resources/public/devbar.css index 84a2223..245bab0 100644 --- a/Resources/public/devbar.css +++ b/Resources/public/devbar.css @@ -5,7 +5,7 @@ left: 0; right: 0; z-index: 1001; /* Higher than top-nav (1000) to ensure it's above */ - background: #8e0000; + background: var(--bg-color-dark, #8e0000); color: white; font-size: 15px; overflow: hidden; @@ -17,10 +17,10 @@ inset: 0; background: repeating-linear-gradient( 45deg, - #b71c1c, - #b71c1c 10px, - #8e0000 10px, - #8e0000 20px + var(--bg-color-light, #b71c1c), + var(--bg-color-light, #b71c1c) 10px, + var(--bg-color-dark, #8e0000) 10px, + var(--bg-color-dark, #8e0000) 20px ); animation: breathe 6s ease-in-out infinite; } diff --git a/Resources/views/devbar.html.twig b/Resources/views/devbar.html.twig index 2b9d2e9..b8b4625 100644 --- a/Resources/views/devbar.html.twig +++ b/Resources/views/devbar.html.twig @@ -10,7 +10,7 @@ crossorigin="anonymous" referrerpolicy="no-referrer" /> -