Skip to content

Commit 6973097

Browse files
πŸš€ Add new price drop banner component (#223)
* πŸš€ Add new price drop banner component * Update copy * wip * Remove comment * Code style * Fix tests * omg pint --------- Co-authored-by: Simon Hamp <simon.hamp@me.com>
1 parent 5308919 commit 6973097

File tree

7 files changed

+94
-27
lines changed

7 files changed

+94
-27
lines changed

β€Žapp/Http/Controllers/Api/TemporaryLinkController.phpβ€Ž

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,9 @@
22

33
namespace App\Http\Controllers\Api;
44

5-
use App\Enums\LicenseSource;
6-
use App\Enums\Subscription;
75
use App\Http\Controllers\Controller;
8-
use App\Http\Resources\Api\LicenseResource;
9-
use App\Jobs\CreateAnystackLicenseJob;
10-
use App\Models\License;
11-
use App\Models\User;
126
use Illuminate\Http\Request;
13-
use Illuminate\Support\Facades\Hash;
147
use Illuminate\Support\Facades\URL;
15-
use Illuminate\Support\Str;
16-
use Illuminate\Validation\Rules\Enum;
178

189
class TemporaryLinkController extends Controller
1910
{
@@ -28,7 +19,7 @@ public function store(Request $request)
2819
$validated['route'],
2920
now()->addMinutes($request->integer('expiration', 30)),
3021
[
31-
'email' => $validated['email']
22+
'email' => $validated['email'],
3223
]
3324
);
3425

β€Žapp/Livewire/MobilePricing.phpβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function mount()
3333

3434
public function handlePurchaseRequest(array $data)
3535
{
36-
if (!$this->user) {
36+
if (! $this->user) {
3737
$user = $this->findOrCreateUser($data['email']);
3838
}
3939

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<svg
2+
{{ $attributes }}
3+
xmlns="http://www.w3.org/2000/svg"
4+
fill="none"
5+
viewBox="0 0 14 14"
6+
>
7+
<path
8+
fill="currentColor"
9+
fill-rule="evenodd"
10+
d="M5 5.125C5 2.9849 6.7349 1.25 8.875 1.25s3.875 1.7349 3.875 3.875c0 1.68622 -1.0774 3.12241 -2.5833 3.65467 -0.32543 0.11503 -0.496 0.4721 -0.38098 0.79755 0.11503 0.32545 0.47208 0.49598 0.79758 0.381C12.573 9.25496 14 7.35743 14 5.125 14 2.29454 11.7055 0 8.875 0 6.04454 0 3.75 2.29454 3.75 5.125c0 0.84601 0.20548 1.64586 0.5698 2.35061 0.15851 0.30663 0.53558 0.42671 0.84221 0.26819 0.30663 -0.15851 0.4267 -0.53558 0.26819 -0.84221C5.15545 6.3701 5 5.76662 5 5.125Zm4.5 -2.75c0 -0.34518 -0.27982 -0.625 -0.625 -0.625s-0.625 0.27982 -0.625 0.625v0.13612c-0.75109 0.09109 -1.33301 0.73085 -1.33301 1.50652 0 0.71319 0.4966 1.33017 1.19333 1.48258l1.17848 0.25779c0.17195 0.03761 0.29487 0.19019 0.29487 0.36664 0 0.20741 -0.16819 0.37537 -0.375 0.37537h-0.32855L8.875 6.5l-0.00512 0.00002H8.542c-0.16231 0 -0.30205 -0.10345 -0.35383 -0.24995 -0.11503 -0.32545 -0.47211 -0.49602 -0.79755 -0.38099 -0.32545 0.11503 -0.49603 0.4721 -0.381 0.79755 0.19143 0.5416 0.66217 0.95235 1.24038 1.05724V7.875c0 0.34518 0.27982 0.625 0.625 0.625s0.625 -0.27982 0.625 -0.625v-0.15103c0.7586 -0.13737 1.3337 -0.80154 1.3337 -1.59932 0 -0.76343 -0.5315 -1.42453 -1.27777 -1.58776l-1.17849 -0.2578c-0.12287 -0.02688 -0.21045 -0.13568 -0.21045 -0.26145 0 -0.14781 0.11983 -0.26764 0.26764 -0.26764h0.43778l0.00259 0.00001 0.00259 -0.00001h0.33108c0.111 0 0.2101 0.04744 0.27966 0.12516 0.03267 0.03649 0.05794 0.07887 0.07417 0.12479 0.11502 0.32545 0.4721 0.49602 0.7975 0.381 0.3255 -0.11503 0.4961 -0.47211 0.381 -0.79756 -0.0715 -0.2025 -0.1817 -0.38601 -0.3213 -0.54188 -0.2353 -0.26298 -0.5566 -0.44954 -0.9197 -0.5154V2.375ZM5.64645 13.1464l1.05805 -1.058L5 10.3839l-1.05806 1.058c-0.24408 0.2441 -0.6398 0.2441 -0.88388 0L0.183058 8.56694c-0.2440774 -0.24408 -0.2440774 -0.6398 0 -0.88388 0.244078 -0.24408 0.639806 -0.24408 0.883882 0L3.5 10.1161l1.05806 -1.05804c0.24408 -0.24408 0.6398 -0.24408 0.88388 0l2.14645 2.14644 1.05806 -1.0581c0.143 -0.143 0.35805 -0.18573 0.54489 -0.1083 0.18684 0.0774 0.30866 0.2597 0.30866 0.4619v3c0 0.2761 -0.22386 0.5 -0.5 0.5H6c-0.20223 0 -0.38455 -0.1218 -0.46194 -0.3087 -0.07739 -0.1868 -0.03461 -0.4019 0.10839 -0.5449Z"
11+
clip-rule="evenodd"
12+
stroke-width="1"
13+
></path>
14+
</svg>

β€Žresources/views/components/navigation-bar.blade.phpβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
x-show="!showMobileMenu"
44
>
55
{{-- Announcement banner goes here --}}
6-
<x-bifrost-banner />
6+
<x-price-drop-banner />
77
</div>
88
<nav
99
class="sticky top-0 z-50 flex flex-col items-center justify-center border-b px-2 transition duration-200 ease-out min-[500px]:px-3"
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<a
2+
href="{{ route('pricing') }}#pricing"
3+
onclick="fathom.trackEvent('alert_click');"
4+
class="group relative z-30 flex flex-col items-center justify-center gap-x-3 gap-y-2.5 overflow-hidden bg-gradient-to-tl from-teal-100 to-gray-200/60 px-5 py-3 select-none 3xs:flex-row dark:from-sky-950/65 dark:to-gray-950/50"
5+
>
6+
{{-- Label --}}
7+
<div
8+
class="flex items-center justify-center gap-3 transition duration-200 ease-in-out will-change-transform group-hover:-translate-x-0.5"
9+
>
10+
{{-- Icon --}}
11+
<x-icons.banner.dollar-decrease
12+
class="h-5 shrink-0 dark:text-cyan-200"
13+
/>
14+
15+
{{-- Text --}}
16+
<div>
17+
<style>
18+
.gradient-text {
19+
background-image: linear-gradient(
20+
90deg,
21+
var(--color-black) 0%,
22+
var(--color-teal-300) 35%,
23+
var(--color-black) 70%
24+
);
25+
background-size: 200% 100%;
26+
animation: shine 2s linear infinite;
27+
}
28+
.dark .gradient-text {
29+
background-image: linear-gradient(
30+
90deg,
31+
var(--color-white) 0%,
32+
var(--color-sky-300) 35%,
33+
var(--color-white) 70%
34+
);
35+
}
36+
@keyframes shine {
37+
from {
38+
background-position: 200% center;
39+
}
40+
to {
41+
background-position: 0% center;
42+
}
43+
}
44+
</style>
45+
<div
46+
class="gradient-text bg-clip-text tracking-tight text-pretty text-transparent sm:text-center"
47+
>
48+
Mobile <b>Pro</b> and <b>Max</b> licenses now up to <em>65% cheaper</em>!
49+
</div>
50+
</div>
51+
</div>
52+
53+
{{-- Icon --}}
54+
<div
55+
class="transition duration-200 ease-in-out will-change-transform group-hover:translate-x-0.5"
56+
>
57+
<x-icons.right-arrow class="size-3 shrink-0" />
58+
</div>
59+
</a>

β€Žresources/views/livewire/mobile-pricing.blade.phpβ€Ž

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<section
2+
id="pricing"
23
class="mx-auto mt-24 max-w-6xl"
34
aria-labelledby="pricing-heading"
45
>
5-
@if(! $discounted)
6+
@if (! $discounted)
67
<header class="relative z-10 grid place-items-center text-center">
78
{{-- Section Heading --}}
89
<h2
@@ -75,21 +76,23 @@ class="mx-auto max-w-xl pt-2 text-base/relaxed text-gray-600 opacity-0"
7576
})
7677
}
7778
"
78-
class="mt-10 grid {{ $discounted ? 'grid-cols-1 md:grid-cols-2' : 'grid-cols-[repeat(auto-fill,minmax(19rem,1fr))]' }} items-start gap-x-6 gap-y-8"
79+
class="{{ $discounted ? 'grid-cols-1 md:grid-cols-2' : 'grid-cols-[repeat(auto-fill,minmax(19rem,1fr))]' }} mt-10 grid items-start gap-x-6 gap-y-8"
7980
aria-label="Pricing plans"
8081
>
81-
@if(! $discounted)
82+
@if (! $discounted)
8283
{{-- Mini Plan --}}
8384
<div
84-
class="dark:bg-mirage h-full rounded-2xl bg-gray-100 p-7 opacity-0"
85+
class="h-full rounded-2xl bg-gray-100 p-7 opacity-0 dark:bg-mirage"
8586
aria-labelledby="pro-plan-heading"
8687
>
8788
{{-- Plan Name --}}
8889
<h3
8990
id="pro-plan-heading"
9091
class="text-3xl font-semibold"
9192
>
92-
<span class="rounded-full bg-zinc-300 dark:bg-zinc-600 px-4">
93+
<span
94+
class="rounded-full bg-zinc-300 px-4 dark:bg-zinc-600"
95+
>
9396
Mini
9497
</span>
9598
</h3>
@@ -99,14 +102,14 @@ class="text-3xl font-semibold"
99102
class="flex items-start gap-1.5 pt-5"
100103
aria-label="Price: FREE (with Bifrost subscription)"
101104
>
102-
<div class="text-5xl font-semibold">
103-
FREE
104-
</div>
105+
<div class="text-5xl font-semibold">FREE</div>
105106
<div class="self-end pb-1.5 text-zinc-500">
106107
with
107-
<a href="/bifrost"
108-
target="_blank"
109-
class="dark:text-zinc-300 underline underline-offset-2 hover:text-zinc-400 dark:hover:text-zinc-100 transition-colors">
108+
<a
109+
href="/bifrost"
110+
target="_blank"
111+
class="underline underline-offset-2 transition-colors hover:text-zinc-400 dark:text-zinc-300 dark:hover:text-zinc-100"
112+
>
110113
Bifrost
111114
</a>
112115
</div>

β€Žtests/Feature/MobilePricingTest.phpβ€Ž

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ public function authenticated_users_will_directly_create_checkout_session()
2222

2323
$component = Livewire::test(MobilePricing::class);
2424
$component->assertSeeHtml([
25-
'wire:click="createCheckoutSession(\'mini\')"',
25+
// 'wire:click="createCheckoutSession(\'mini\')"',
2626
'wire:click="createCheckoutSession(\'pro\')"',
2727
'wire:click="createCheckoutSession(\'max\')"',
2828
]);
2929
$component->assertDontSeeHtml([
30-
'@click="$dispatch(\'open-purchase-modal\', { plan: \'mini\' })"',
30+
// '@click="$dispatch(\'open-purchase-modal\', { plan: \'mini\' })"',
3131
'@click="$dispatch(\'open-purchase-modal\', { plan: \'pro\' })"',
3232
'@click="$dispatch(\'open-purchase-modal\', { plan: \'max\' })"',
3333
]);
@@ -41,12 +41,12 @@ public function guest_users_see_purchase_modal_component()
4141
Livewire::test(MobilePricing::class)
4242
->assertSeeLivewire('purchase-modal')
4343
->assertSeeHtml([
44-
'@click="$dispatch(\'open-purchase-modal\', { plan: \'mini\' })"',
44+
// '@click="$dispatch(\'open-purchase-modal\', { plan: \'mini\' })"',
4545
'@click="$dispatch(\'open-purchase-modal\', { plan: \'pro\' })"',
4646
'@click="$dispatch(\'open-purchase-modal\', { plan: \'max\' })"',
4747
])
4848
->assertDontSeeHtml([
49-
'wire:click="createCheckoutSession(\'mini\')"',
49+
// 'wire:click="createCheckoutSession(\'mini\')"',
5050
'wire:click="createCheckoutSession(\'pro\')"',
5151
'wire:click="createCheckoutSession(\'max\')"',
5252
]);

0 commit comments

Comments
Β (0)