Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 25 additions & 47 deletions resources/views/components/black-friday-banner.blade.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
<a
href="/bifrost"
onclick="fathom.trackEvent('black_friday_banner_click');"
class="group relative z-30 flex flex-col items-center justify-center gap-3 overflow-hidden bg-gradient-to-tl from-orange-100 to-gray-200/60 px-5 py-3 select-none sm:flex-row dark:from-orange-950/65 dark:to-gray-950/50"
href="https://bifrost.nativephp.com/newsletter"
target="_blank"
rel="noopener"
onclick="window.fathom?.trackEvent('bifrost_black_friday_banner_click')"
data-site-banner
class="group relative z-30 flex flex-col flex-wrap items-center justify-center gap-x-3 gap-y-2.5 overflow-hidden bg-gradient-to-tl from-orange-100 to-gray-200/60 px-5 py-3 select-none 3xs:flex-row dark:from-orange-950/65 dark:to-gray-950/50"
>
{{-- Label Section --}}
{{-- Label --}}
<div
class="flex flex-col items-center gap-2 transition duration-200 ease-in-out will-change-transform group-hover:-translate-x-0.5 sm:flex-row sm:gap-3"
class="flex items-center justify-center gap-3 transition duration-200 ease-in-out will-change-transform group-hover:-translate-x-0.5"
>
{{-- Icon --}}
<x-icons.banner.dollar-decrease
class="h-5 shrink-0 dark:text-orange-200"
aria-hidden="true"
/>

{{-- Text --}}
<div class="text-center sm:text-left">
<div>
<style>
.bf-gradient-text {
background-image: linear-gradient(
Expand All @@ -23,7 +27,7 @@ class="h-5 shrink-0 dark:text-orange-200"
var(--color-black) 70%
);
background-size: 200% 100%;
animation: shine 2s linear infinite;
animation: bf-shine 2s linear infinite;
}
.dark .bf-gradient-text {
background-image: linear-gradient(
Expand All @@ -33,7 +37,7 @@ class="h-5 shrink-0 dark:text-orange-200"
var(--color-white) 70%
);
}
@keyframes shine {
@keyframes bf-shine {
from {
background-position: 200% center;
}
Expand All @@ -43,53 +47,27 @@ class="h-5 shrink-0 dark:text-orange-200"
}
</style>
<div
class="bf-gradient-text bg-clip-text tracking-tight text-pretty text-transparent"
class="bf-gradient-text bg-clip-text tracking-tight text-pretty text-transparent sm:text-center"
>
<b>Black Friday:</b> <em>40% off</em> Bifrost <b>Hela</b> & <b>Thor</b> plans • Code: <b>BLACKFRIDAY40</b>
<b>Black Friday:</b>
up to
<b>50% off</b>
Bifrost annual plans
</div>
</div>
</div>

{{-- Countdown Timer --}}
<div
x-data="countdown('2025-12-02T00:00:00Z')"
class="flex items-center gap-2 text-xs font-medium"
{{-- Call to action --}}
<span
class="shrink-0 rounded-md bg-white/70 px-2 py-0.5 text-sm font-semibold text-orange-900 ring-1 ring-orange-200 dark:bg-white/10 dark:text-orange-100 dark:ring-white/10"
>
<span class="text-gray-600 dark:text-gray-400">Ends in:</span>
<div class="flex items-center gap-1">
<number-flow
x-ref="dd"
class="font-bold tabular-nums"
></number-flow>
<span class="text-gray-500 dark:text-gray-400">d</span>
</div>
<div class="flex items-center gap-1">
<number-flow
x-ref="hh"
class="font-bold tabular-nums"
></number-flow>
<span class="text-gray-500 dark:text-gray-400">h</span>
</div>
<div class="flex items-center gap-1">
<number-flow
x-ref="mm"
class="font-bold tabular-nums"
></number-flow>
<span class="text-gray-500 dark:text-gray-400">m</span>
</div>
<div class="flex items-center gap-1">
<number-flow
x-ref="ss"
class="font-bold tabular-nums"
></number-flow>
<span class="text-gray-500 dark:text-gray-400">s</span>
</div>
</div>
Get the code by email
</span>

{{-- Icon --}}
{{-- Arrow --}}
<div
class="hidden transition duration-200 ease-in-out will-change-transform group-hover:translate-x-0.5 sm:block"
class="transition duration-200 ease-in-out will-change-transform group-hover:translate-x-0.5"
>
<x-icons.right-arrow class="size-3 shrink-0" />
</div>
</a>
</a>
4 changes: 3 additions & 1 deletion resources/views/components/layout.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@
"
class="min-h-screen overflow-x-clip bg-white font-poppins antialiased selection:bg-black selection:text-[#b4a9ff] dark:bg-[#050714] dark:text-white"
>
@if (now()->isBefore('2027-01-01T00:00:00Z'))
@if (now()->isBefore('2026-12-01T08:00:00Z'))
<x-black-friday-banner />
@elseif (now()->isBefore('2027-01-01T00:00:00Z'))
<x-bifrost-birthday-banner />
@else
<x-newsletter-banner />
Expand Down
55 changes: 55 additions & 0 deletions tests/Feature/BifrostBlackFridayBannerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

namespace Tests\Feature;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Carbon;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;

class BifrostBlackFridayBannerTest extends TestCase
{
use RefreshDatabase;

#[Test]
public function the_banner_sends_people_to_the_bifrost_newsletter_in_a_new_tab(): void
{
$this->blade('<x-black-friday-banner />')
->assertSee('Black Friday:')
->assertSee('50% off')
->assertSee('href="https://bifrost.nativephp.com/newsletter"', escape: false)
->assertSee('target="_blank"', escape: false)
->assertSee('rel="noopener"', escape: false)
->assertSee('bifrost_black_friday_banner_click', escape: false);
}

#[Test]
public function the_banner_never_shows_a_discount_code(): void
{
$this->blade('<x-black-friday-banner />')
->assertDontSee('BLACKFRIDAY')
->assertDontSee('HAPPYBIRTHDAY');
}

#[Test]
public function the_homepage_carries_the_black_friday_banner_until_the_sale_ends(): void
{
$this->travelTo(Carbon::parse('2026-12-01T07:59:59Z'));

$this->get('/')
->assertOk()
->assertSee('bifrost_black_friday_banner_click', escape: false)
->assertDontSee('bifrost_birthday_banner_click', escape: false);
}

#[Test]
public function the_birthday_banner_comes_back_once_the_sale_ends(): void
{
$this->travelTo(Carbon::parse('2026-12-01T08:00:00Z'));

$this->get('/')
->assertOk()
->assertDontSee('bifrost_black_friday_banner_click', escape: false)
->assertSee('bifrost_birthday_banner_click', escape: false);
}
}