From 21afd25af07786957cfb581cb298ec571e7a689d Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Thu, 10 Sep 2026 13:11:43 +0100 Subject: [PATCH] Make nav buttons readable over dark content Ultra, Masterclass and Build now use the same pill as the Mobile and Desktop dropdowns, so they keep their contrast when the sticky nav floats over dark images. The Bifrost button just says Bifrost instead of cycling through words. Co-Authored-By: Claude Opus 5 (1M context) --- .../views/components/bifrost-button.blade.php | 59 +-------------- .../views/components/navigation-bar.blade.php | 6 +- tests/Feature/NavigationBarTest.php | 74 +++++++++++++++++++ 3 files changed, 78 insertions(+), 61 deletions(-) create mode 100644 tests/Feature/NavigationBarTest.php diff --git a/resources/views/components/bifrost-button.blade.php b/resources/views/components/bifrost-button.blade.php index 86cb001ac..78e58297b 100644 --- a/resources/views/components/bifrost-button.blade.php +++ b/resources/views/components/bifrost-button.blade.php @@ -4,39 +4,6 @@ diff --git a/resources/views/components/navigation-bar.blade.php b/resources/views/components/navigation-bar.blade.php index 45743be45..259624999 100644 --- a/resources/views/components/navigation-bar.blade.php +++ b/resources/views/components/navigation-bar.blade.php @@ -81,7 +81,7 @@ class="-mt-px size-3.5" {{-- Ultra link (desktop only) --}} @@ -89,7 +89,7 @@ class="hidden items-center gap-1.5 rounded-full bg-orange-500/10 px-3 py-1.5 tex {{-- Course link (desktop only) --}} @@ -97,7 +97,7 @@ class="hidden items-center gap-1.5 rounded-full bg-emerald-500/10 px-3 py-1.5 te {{-- Build link (desktop only) --}} diff --git a/tests/Feature/NavigationBarTest.php b/tests/Feature/NavigationBarTest.php new file mode 100644 index 000000000..e312a7dc1 --- /dev/null +++ b/tests/Feature/NavigationBarTest.php @@ -0,0 +1,74 @@ +', ''] as $template) { + $button = $this->blade($template); + + $this->assertSame('Bifrost', trim(strip_tags((string) $button))); + + $button->assertDontSee('gsap', escape: false); + } + } + + /** + * Ultra, Masterclass and Build used to be tinted, see-through pills that + * lost their contrast whenever the sticky nav floated over dark content. + * They now share the resting background of the Mobile and Desktop dropdown + * buttons, so the expected classes are read off the Mobile dropdown itself. + */ + #[Test] + public function the_desktop_nav_links_share_the_device_dropdown_background(): void + { + $dom = new DOMDocument; + libxml_use_internal_errors(true); + $dom->loadHTML(''.$this->get('/')->assertOk()->getContent()); + libxml_clear_errors(); + + $xpath = new DOMXPath($dom); + + $dropdownClasses = $xpath->query('//button[@id="mobile-dropdown-btn"]')->item(0)?->getAttribute(':class'); + + $this->assertSame( + 1, + preg_match("/'([^']+)':\s*!open/", (string) $dropdownClasses, $closedDropdown), + 'Could not read the resting background of the Mobile dropdown button.', + ); + + $expectedClasses = preg_split('/\s+/', $closedDropdown[1], flags: PREG_SPLIT_NO_EMPTY); + + $links = [ + 'Ultra' => route('pricing'), + 'Masterclass' => route('course'), + 'Build' => route('build-my-app'), + ]; + + foreach ($links as $label => $href) { + $link = $xpath->query("//nav[@data-site-nav]/div/div/a[@href='{$href}']")->item(0); + + $this->assertNotNull($link, "The {$label} link is missing from the nav bar."); + $this->assertSame($label, trim($link->textContent)); + + $linkClasses = preg_split('/\s+/', $link->getAttribute('class'), flags: PREG_SPLIT_NO_EMPTY); + + $this->assertSame( + [], + array_values(array_diff($expectedClasses, $linkClasses)), + "The {$label} link should use the same background as the Mobile and Desktop dropdowns.", + ); + } + } +}