refactor(portal): Add website_link component (#3715)

https://github.com/firezone/firezone/pull/3579#discussion_r1496082754

---------

Co-authored-by: Gabi <gabrielalejandro7@gmail.com>
Co-authored-by: Reactor Scram <ReactorScram@users.noreply.github.com>
This commit is contained in:
Jamil
2024-02-21 16:45:45 -08:00
committed by GitHub
parent 6256d94799
commit afc753f5df
11 changed files with 74 additions and 55 deletions

View File

@@ -1214,10 +1214,19 @@ defmodule Web.CoreComponents do
---
Please do not remove this part of the email.
Account Name: #{account.name}
Account Slug: #{account.slug}
Account ID: #{account.id}
Actor ID: #{subject.actor.id}
"""
"mailto:support@firezone.dev?subject=#{URI.encode_www_form(email_subject)}&body=#{URI.encode_www_form(body)}"
end
def link_style do
[
"text-accent-500",
"hover:underline"
]
end
end

View File

@@ -308,4 +308,30 @@ defmodule Web.NavigationComponents do
</div>
"""
end
@doc """
Renders links based off our website path.
## Examples
<.website_link href="/pricing>Pricing</.website_link>
<.website_link href="/kb/deploy/gateways" class="text-neutral-900">Deploy Gateway(s)</.website_link>
<.website_link href={~p"/contact/sales"}>Contact Sales</.website_link>
"""
attr :href, :string, required: true
slot :inner_block, required: true
attr :rest, :global
def website_link(assigns) do
~H"""
<.link
navigate={"https://www.firezone.dev#{@href}?utm_source=product"}
class={link_style()}
target="_blank"
{@rest}
>
<%= render_slot(@inner_block) %>
</.link>
"""
end
end

View File

@@ -63,11 +63,4 @@ defmodule Web.PageComponents do
</.section>
"""
end
def link_style do
[
"text-accent-500",
"hover:underline"
]
end
end

View File

@@ -197,10 +197,10 @@ defmodule Web.RelayGroups.NewToken do
<div id="connection-status" class="flex justify-between items-center">
<p class="text-sm">
Relay not connecting? See our <.link
class="text-accent-500 hover:underline"
href="https://www.firezone.dev/kb/administer/troubleshooting#relay-not-connecting"
>relay troubleshooting guide</.link>.
Relay not connecting? See our
<.website_link href="/kb/administer/troubleshooting">
relay troubleshooting guide
</.website_link>.
</p>
<.initial_connection_status
:if={@env}

View File

@@ -39,13 +39,9 @@ defmodule Web.Settings.DNS do
resolver will be used.
</p>
<p class="ml-4 mb-4 text-neutral-600">
<.link
class={link_style()}
href="https://www.firezone.dev/kb/administer/dns?utm_source=product"
target="_blank"
>
<.website_link href="/kb/administer/dns">
Read more about configuring DNS in Firezone.
</.link>
</.website_link>
</p>
<div class="max-w-2xl px-4 py-8 mx-auto lg:py-16">
<.flash kind={:success} flash={@flash} phx-click="lv:clear-flash" />

View File

@@ -42,13 +42,10 @@ defmodule Web.Settings.IdentityProviders.Index do
</.add_button>
</:action>
<:help>
<.link
class={link_style()}
href="https://www.firezone.dev/kb/authenticate?utm_source=product"
target="_blank"
>
Read more about how authentication works in Firezone.
</.link>
<.website_link href="/kb/authenticate">
Read more
</.website_link>
about how authentication works in Firezone.
</:help>
<:content>
<.flash_group flash={@flash} />

View File

@@ -109,9 +109,9 @@ defmodule Web.SignIn do
<div :if={Web.Auth.fetch_auth_context_type!(@params) == :browser} class="mx-auto p-6 sm:p-8">
<p class="py-2">
Meant to sign in from a client instead?
<a href="https://firezone.dev/kb/user-guides?utm_source=product" class={link_style()}>
<.website_link href="/kb/user-guides">
Read the docs.
</a>
</.website_link>
</p>
</div>
</div>

View File

@@ -44,19 +44,17 @@ defmodule Web.Sites.NewToken do
Gateways require egress connectivity to the control plane API and relay servers.
<strong>No ingress firewall rules</strong>
are required or recommended. See our
<.link
href="https://www.firezone.dev/kb/deploy/gateways#firewall-considerations?utm_source=product"
class={link_style()}
>
<.website_link href="/kb/deploy/gateways#firewall-considerations">
deploy guide
</.link>
</.website_link>
for more information.
</:help>
<:help>
<.link
href="http://www.firezone.dev/kb/deploy/gateways?utm_source=product"
class="text-accent-500 hover:underline"
>Read the gateway deployment guide for more detailed instructions</.link>.
Read the
<.website_link href="/kb/deploy/gateways">
gateway deployment guide
</.website_link>
for more detailed instructions.
</:help>
<:content>
<div class="py-8 px-4 mx-auto max-w-2xl lg:py-16">
@@ -111,10 +109,10 @@ defmodule Web.Sites.NewToken do
<div id="connection-status" class="flex justify-between items-center">
<p class="text-sm">
Gateway not connecting? See our <.link
class="text-accent-500 hover:underline"
href="https://www.firezone.dev/kb/administer/troubleshooting#gateway-not-connecting"
>gateway troubleshooting guide</.link>.
Gateway not connecting? See our
<.website_link href="/kb/administer/troubleshooting#gateway-not-connecting">
gateway troubleshooting guide
</.website_link>.
</p>
<.initial_connection_status
:if={@env}

View File

@@ -56,7 +56,7 @@
class="sm-my-8"
style="margin-top: 48px; margin-bottom: 48px; text-align: center"
>
<a href="https://firezone.dev">
<a href="https://firezone.dev?utm_source=email">
<div>
<img
src="https://www.firezone.dev/images/logo-lockup.png"
@@ -89,22 +89,22 @@
To start accessing your resources, simply install one of the Firezone clients:
<ul>
<li>
<a href="https://www.firezone.dev/kb/user-guides/apple-client">
<a href="https://www.firezone.dev/kb/user-guides/apple-client?utm_source=email">
Apple Client (macOS/iOS)
</a>
</li>
<li>
<a href="https://www.firezone.dev/kb/user-guides/windows-client">
<a href="https://www.firezone.dev/kb/user-guides/windows-client?utm_source=email">
Windows Client
</a>
</li>
<li>
<a href="https://www.firezone.dev/kb/user-guides/android-client">
<a href="https://www.firezone.dev/kb/user-guides/android-client?utm_source=email">
Android / ChromeOS Client
</a>
</li>
<li>
<a href="https://www.firezone.dev/kb/user-guides/linux-client">
<a href="https://www.firezone.dev/kb/user-guides/linux-client?utm_source=email">
Linux Client
</a>
</li>
@@ -137,7 +137,7 @@
</p>
<p style="cursor: default">
<a
href="https://www.firezone.dev/kb"
href="https://www.firezone.dev/kb?utm_source=email"
class="hover-important-text-decoration-underline"
style="color: #37007f; text-decoration: none"
>
@@ -145,7 +145,7 @@
</a>
&bull;
<a
href="https://github.com/firezone"
href="https://github.com/firezone?utm_source=email"
class="hover-important-text-decoration-underline"
style="color: #37007f; text-decoration: none;"
>
@@ -153,7 +153,7 @@
</a>
&bull;
<a
href="https://x.com/firezonehq"
href="https://x.com/firezonehq?utm_source=email"
class="hover-important-text-decoration-underline"
style="color: #37007f; text-decoration: none;"
>

View File

@@ -64,7 +64,7 @@
class="sm-my-8"
style="margin-top: 48px; margin-bottom: 48px; text-align: center"
>
<a href="https://firezone.dev">
<a href="https://firezone.dev?utm_source=email">
<div>
<img
src="https://www.firezone.dev/images/logo-lockup.png"
@@ -206,7 +206,7 @@
</p>
<p style="cursor: default">
<a
href="https://www.firezone.dev/kb"
href="https://www.firezone.dev/kb?utm_source=email"
class="hover-important-text-decoration-underline"
style="color: #37007f; text-decoration: none"
>
@@ -214,7 +214,7 @@
</a>
&bull;
<a
href="https://github.com/firezone"
href="https://github.com/firezone?utm_source=email"
class="hover-important-text-decoration-underline"
style="color: #37007f; text-decoration: none;"
>
@@ -222,7 +222,7 @@
</a>
&bull;
<a
href="https://x.com/firezonehq"
href="https://x.com/firezonehq?utm_source=email"
class="hover-important-text-decoration-underline"
style="color: #37007f; text-decoration: none;"
>

View File

@@ -64,7 +64,7 @@
class="sm-my-8"
style="margin-top: 48px; margin-bottom: 48px; text-align: center"
>
<a href="https://firezone.dev">
<a href="https://firezone.dev?utm_source=email">
<div>
<img
src="https://www.firezone.dev/images/logo-lockup.png"
@@ -182,7 +182,7 @@
</p>
<p style="cursor: default">
<a
href="https://www.firezone.dev/kb"
href="https://www.firezone.dev/kb?utm_source=email"
class="hover-important-text-decoration-underline"
style="color: #37007f; text-decoration: none"
>
@@ -190,7 +190,7 @@
</a>
&bull;
<a
href="https://github.com/firezone"
href="https://github.com/firezone?utm_source=email"
class="hover-important-text-decoration-underline"
style="color: #37007f; text-decoration: none;"
>
@@ -198,7 +198,7 @@
</a>
&bull;
<a
href="https://x.com/firezonehq"
href="https://x.com/firezonehq?utm_source=email"
class="hover-important-text-decoration-underline"
style="color: #37007f; text-decoration: none;"
>