comfycamp/lib/comfycamp_web/components/home.ex

31 lines
820 B
Elixir

defmodule ComfycampWeb.Home do
@moduledoc """
Components for the home page.
"""
use Phoenix.Component
import ComfycampWeb.Icons
@doc """
A component representing one service, like mastodon or nextcloud.
"""
attr :name, :string, required: true
attr :domain, :string, required: true
attr :description, :string, required: true
attr :enable_link, :boolean, required: false, default: true
def service(assigns) do
~H"""
<div class="service">
<h3><%= @name %></h3>
<%= if @enable_link do %>
<a class="link" href={"https://" <> @domain} target="_blank">
<%= @domain %> <.arrow_top_right_on_square_icon />
</a>
<% else %>
<span class="link"><%= @domain %></span>
<% end %>
<p><%= @description %></p>
</div>
"""
end
end