Skip to content

Commit 8e5d963

Browse files
committed
feat: refactor homepage layout and introduce new pattern component
- Removed redundant comments and streamlined the layout for clarity. - Introduced a new `pattern` component to enhance the visual design of the homepage. - Updated sections to utilize the new pattern for a cohesive background effect. - Adjusted section structures for improved accessibility and responsiveness.
1 parent 4f4f2a6 commit 8e5d963

File tree

1 file changed

+54
-60
lines changed

1 file changed

+54
-60
lines changed

lib/algora_web/live/home_live.ex

Lines changed: 54 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ defmodule AlgoraWeb.HomeLive do
2424

2525
require Logger
2626

27-
#
28-
2927
@impl true
3028
def mount(%{"country_code" => country_code}, _session, socket) do
3129
Gettext.put_locale(AlgoraWeb.Gettext, Algora.Util.locale_from_country_code(country_code))
@@ -47,55 +45,54 @@ defmodule AlgoraWeb.HomeLive do
4745
|> assign(:pending_action, nil)}
4846
end
4947

48+
defp pattern(assigns) do
49+
~H"""
50+
<div
51+
class="absolute inset-x-0 -top-40 -z-10 transform overflow-hidden blur-3xl sm:-top-80"
52+
aria-hidden="true"
53+
>
54+
<div
55+
class="left-[calc(50%-11rem)] aspect-[1155/678] w-[36.125rem] rotate-[30deg] relative -translate-x-1/2 bg-gradient-to-tr from-slate-400 to-secondary opacity-20 sm:left-[calc(50%-30rem)] sm:w-[72.1875rem]"
56+
style="clip-path: polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)"
57+
>
58+
</div>
59+
</div>
60+
61+
<div class="[mask-image:radial-gradient(32rem_32rem_at_center,white,transparent)] absolute inset-x-0 -z-10 h-screen w-full stroke-border">
62+
<defs>
63+
<pattern
64+
id="grid-pattern"
65+
width="200"
66+
height="200"
67+
x="50%"
68+
y="-1"
69+
patternUnits="userSpaceOnUse"
70+
>
71+
<path d="M.5 200V.5H200" fill="none" />
72+
</pattern>
73+
</defs>
74+
<rect width="100%" height="100%" stroke-width="0" fill="url(#grid-pattern)" opacity="0.25" />
75+
</div>
76+
77+
<div class="absolute inset-x-0 -z-10 transform overflow-hidden blur-3xl" aria-hidden="true">
78+
<div
79+
class="left-[calc(50%+3rem)] aspect-[1155/678] w-[36.125rem] relative -translate-x-1/2 bg-gradient-to-tr from-slate-400 to-secondary opacity-20 sm:left-[calc(50%+36rem)] sm:w-[72.1875rem]"
80+
style="clip-path: polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)"
81+
>
82+
</div>
83+
</div>
84+
"""
85+
end
86+
5087
@impl true
5188
def render(assigns) do
5289
~H"""
5390
<div>
5491
<Header.header />
5592
5693
<main>
57-
<div class="relative isolate overflow-hidden min-h-screen bg-gradient-to-br from-black to-background">
58-
<!-- Background pattern -->
59-
<div
60-
class="absolute inset-x-0 -top-40 -z-10 transform overflow-hidden blur-3xl sm:-top-80"
61-
aria-hidden="true"
62-
>
63-
<div
64-
class="left-[calc(50%-11rem)] aspect-[1155/678] w-[36.125rem] rotate-[30deg] relative -translate-x-1/2 bg-gradient-to-tr from-slate-400 to-secondary opacity-20 sm:left-[calc(50%-30rem)] sm:w-[72.1875rem]"
65-
style="clip-path: polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)"
66-
>
67-
</div>
68-
</div>
69-
70-
<div class="[mask-image:radial-gradient(32rem_32rem_at_center,white,transparent)] absolute inset-x-0 -z-10 h-screen w-full stroke-border">
71-
<defs>
72-
<pattern
73-
id="grid-pattern"
74-
width="200"
75-
height="200"
76-
x="50%"
77-
y="-1"
78-
patternUnits="userSpaceOnUse"
79-
>
80-
<path d="M.5 200V.5H200" fill="none" />
81-
</pattern>
82-
</defs>
83-
<rect
84-
width="100%"
85-
height="100%"
86-
stroke-width="0"
87-
fill="url(#grid-pattern)"
88-
opacity="0.25"
89-
/>
90-
</div>
91-
92-
<div class="absolute inset-x-0 -z-10 transform overflow-hidden blur-3xl" aria-hidden="true">
93-
<div
94-
class="left-[calc(50%+3rem)] aspect-[1155/678] w-[36.125rem] relative -translate-x-1/2 bg-gradient-to-tr from-slate-400 to-secondary opacity-20 sm:left-[calc(50%+36rem)] sm:w-[72.1875rem]"
95-
style="clip-path: polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)"
96-
>
97-
</div>
98-
</div>
94+
<section class="relative isolate overflow-hidden min-h-screen bg-gradient-to-br from-black to-background">
95+
<.pattern />
9996
<!-- Hero content -->
10097
<div class="mx-auto max-w-7xl px-6 pt-24 pb-12 lg:px-8 xl:pt-20">
10198
<div class="mx-auto gap-x-14 lg:mx-0 lg:flex lg:max-w-none lg:items-center">
@@ -126,7 +123,6 @@ defmodule AlgoraWeb.HomeLive do
126123
Developers
127124
</.button>
128125
</div>
129-
130126
</div>
131127
<!-- Featured devs -->
132128
<div class="mt-14 flex justify-start md:justify-center gap-8 lg:justify-start lg:mt-0 lg:pl-0 overflow-x-auto scrollbar-thin lg:overflow-x-visible">
@@ -150,9 +146,9 @@ defmodule AlgoraWeb.HomeLive do
150146
</div>
151147
</div>
152148
</div>
153-
</div>
149+
</section>
154150
155-
<section class="bg-gradient-to-br from-black to-background border-t py-16 sm:py-32">
151+
<section class="relative isolate bg-gradient-to-br from-black to-background border-t py-16 sm:py-32">
156152
<div class="mx-auto max-w-7xl px-6 lg:px-8">
157153
<h2 class="font-display text-3xl font-semibold tracking-tight text-foreground sm:text-6xl text-center mb-4">
158154
Fund GitHub Issues
@@ -272,20 +268,19 @@ defmodule AlgoraWeb.HomeLive do
272268
</div>
273269
</section>
274270
275-
276-
<section class="bg-gradient-to-br from-black to-background border-t py-16 sm:py-32">
271+
<section class="relative isolate bg-gradient-to-br from-black to-background border-t py-16 sm:py-32">
272+
<.pattern />
277273
<div class="mx-auto max-w-7xl px-6 lg:px-8">
278274
<h2 class="font-display text-3xl font-semibold tracking-tight text-foreground sm:text-6xl text-center mb-4 leading-loose">
279275
Y Combinator companies use Algora<br />to build product and hire engineers
280276
</h2>
281277
<div class="mx-auto mt-8 max-w-2xl gap-8 text-sm leading-6 sm:mt-10">
282-
<.yc_logo_cloud />
283-
</div>
278+
<.yc_logo_cloud />
279+
</div>
284280
</div>
285281
</section>
286282
287-
288-
<section class="bg-gradient-to-br from-black to-background border-t py-16 sm:py-32">
283+
<section class="relative isolate bg-gradient-to-br from-black to-background border-t py-16 sm:py-32">
289284
<div class="mx-auto max-w-7xl px-6 lg:px-8">
290285
<h2 class="font-display text-3xl font-semibold tracking-tight text-foreground sm:text-6xl text-center mb-4">
291286
Build product faster
@@ -489,7 +484,8 @@ defmodule AlgoraWeb.HomeLive do
489484
</div>
490485
</section>
491486
492-
<section class="bg-gradient-to-br from-black to-background border-t py-16 sm:py-32">
487+
<section class="relative isolate bg-gradient-to-br from-black to-background border-t py-16 sm:py-32">
488+
<.pattern />
493489
<div class="mx-auto max-w-7xl px-6 lg:px-8">
494490
<h2 class="font-display text-3xl font-semibold tracking-tight text-foreground sm:text-4xl text-center mb-4">
495491
Hire with Confidence
@@ -723,7 +719,7 @@ defmodule AlgoraWeb.HomeLive do
723719
</div>
724720
</section>
725721
726-
<section class="bg-background border-t py-16 sm:py-32">
722+
<section class="relative isolate bg-background border-t py-16 sm:py-32">
727723
<div class="mx-auto max-w-7xl px-6 lg:px-8">
728724
<h2 class="mb-8 text-3xl font-bold text-card-foreground text-center">
729725
<span class="text-muted-foreground">The open source</span>
@@ -740,7 +736,7 @@ defmodule AlgoraWeb.HomeLive do
740736
</div>
741737
</section>
742738
743-
<div class="bg-gradient-to-br from-black to-background">
739+
<div class="relative isolate bg-gradient-to-br from-black to-background">
744740
<Footer.footer />
745741
<div class="mx-auto max-w-7xl px-6 pb-4 text-center text-xs text-muted-foreground">
746742
Upwork® is a registered trademark of Upwork Global Inc. Algora is not affiliated with, sponsored by, or endorsed by Upwork Global Inc, mmmkay?
@@ -776,8 +772,7 @@ defmodule AlgoraWeb.HomeLive do
776772
|> redirect(to: ~p"/")}
777773

778774
{:error, :already_exists} ->
779-
{:noreply,
780-
put_flash(socket, :warning, "You have already created a bounty for this ticket")}
775+
{:noreply, put_flash(socket, :warning, "You have already created a bounty for this ticket")}
781776

782777
{:error, _reason} ->
783778
{:noreply, put_flash(socket, :error, "Something went wrong")}
@@ -1008,8 +1003,7 @@ defmodule AlgoraWeb.HomeLive do
10081003
"""
10091004
end
10101005

1011-
defp format_money(money),
1012-
do: money |> Money.round(currency_digits: 0) |> Money.to_string!(no_fraction_if_integer: true)
1006+
defp format_money(money), do: money |> Money.round(currency_digits: 0) |> Money.to_string!(no_fraction_if_integer: true)
10131007

10141008
defp format_number(number), do: Number.Delimit.number_to_delimited(number, precision: 0)
10151009

0 commit comments

Comments
 (0)