Skip to content

Commit

Permalink
auto format code
Browse files Browse the repository at this point in the history
  • Loading branch information
leandrocp authored and github-actions[bot] committed Dec 5, 2024
1 parent b53d96d commit 0f97c80
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 45 deletions.
60 changes: 30 additions & 30 deletions lib/beacon/web/components/core_components.ex
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ defmodule Beacon.Web.CoreComponents do
</button>
</div>
<div id={"#{@id}-content"}>
<%= render_slot(@inner_block) %>
{render_slot(@inner_block)}
</div>
</.focus_wrap>
</div>
Expand Down Expand Up @@ -113,9 +113,9 @@ defmodule Beacon.Web.CoreComponents do
<p :if={@title} class="flex items-center gap-1.5 text-sm font-semibold leading-6">
<.icon :if={@kind == :info} name="hero-information-circle-mini" class="h-4 w-4" />
<.icon :if={@kind == :error} name="hero-exclamation-circle-mini" class="h-4 w-4" />
<%= @title %>
{@title}
</p>
<p class="mt-2 text-sm leading-5"><%= msg %></p>
<p class="mt-2 text-sm leading-5">{msg}</p>
<button type="button" class="group absolute top-1 right-1 p-2" aria-label={gettext("close")}>
<.icon name="hero-x-mark-solid" class="h-5 w-5 opacity-40 group-hover:opacity-70" />
</button>
Expand Down Expand Up @@ -146,7 +146,7 @@ defmodule Beacon.Web.CoreComponents do
phx-connected={hide("#client-error")}
hidden
>
<%= gettext("Attempting to reconnect") %>
{gettext("Attempting to reconnect")}
<.icon name="hero-arrow-path" class="ml-1 h-3 w-3 animate-spin" />
</.flash>
Expand All @@ -158,7 +158,7 @@ defmodule Beacon.Web.CoreComponents do
phx-connected={hide("#server-error")}
hidden
>
<%= gettext("Hang in there while we get back on track") %>
{gettext("Hang in there while we get back on track")}
<.icon name="hero-arrow-path" class="ml-1 h-3 w-3 animate-spin" />
</.flash>
</div>
Expand Down Expand Up @@ -192,9 +192,9 @@ defmodule Beacon.Web.CoreComponents do
~H"""
<.form :let={f} for={@for} as={@as} {@rest}>
<div class="mt-10 space-y-8 bg-white">
<%= render_slot(@inner_block, f) %>
{render_slot(@inner_block, f)}
<div :for={action <- @actions} class="mt-2 flex items-center justify-between gap-6">
<%= render_slot(action, f) %>
{render_slot(action, f)}
</div>
</div>
</.form>
Expand Down Expand Up @@ -226,7 +226,7 @@ defmodule Beacon.Web.CoreComponents do
]}
{@rest}
>
<%= render_slot(@inner_block) %>
{render_slot(@inner_block)}
</button>
"""
end
Expand Down Expand Up @@ -297,36 +297,36 @@ defmodule Beacon.Web.CoreComponents do
<label class="flex items-center gap-4 text-sm leading-6 text-zinc-600">
<input type="hidden" name={@name} value="false" />
<input type="checkbox" id={@id} name={@name} value="true" checked={@checked} class="rounded border-zinc-300 text-zinc-900 focus:ring-0" {@rest} />
<%= @label %>
{@label}
</label>
<.error :for={msg <- @errors}><%= msg %></.error>
<.error :for={msg <- @errors}>{msg}</.error>
</div>
"""
end

def input(%{type: "select"} = assigns) do
~H"""
<div phx-feedback-for={@name}>
<.label for={@id}><%= @label %></.label>
<.label for={@id}>{@label}</.label>
<select
id={@id}
name={@name}
class="mt-2 block w-full rounded-md border border-gray-300 bg-white shadow-sm focus:border-zinc-400 focus:ring-0 sm:text-sm"
multiple={@multiple}
{@rest}
>
<option :if={@prompt} value=""><%= @prompt %></option>
<%= Phoenix.HTML.Form.options_for_select(@options, @value) %>
<option :if={@prompt} value="">{@prompt}</option>
{Phoenix.HTML.Form.options_for_select(@options, @value)}
</select>
<.error :for={msg <- @errors}><%= msg %></.error>
<.error :for={msg <- @errors}>{msg}</.error>
</div>
"""
end

def input(%{type: "textarea"} = assigns) do
~H"""
<div phx-feedback-for={@name}>
<.label for={@id}><%= @label %></.label>
<.label for={@id}>{@label}</.label>
<textarea
id={@id}
name={@name}
Expand All @@ -338,7 +338,7 @@ defmodule Beacon.Web.CoreComponents do
]}
{@rest}
><%= Phoenix.HTML.Form.normalize_value("textarea", @value) %></textarea>
<.error :for={msg <- @errors}><%= msg %></.error>
<.error :for={msg <- @errors}>{msg}</.error>
</div>
"""
end
Expand All @@ -347,7 +347,7 @@ defmodule Beacon.Web.CoreComponents do
def input(assigns) do
~H"""
<div phx-feedback-for={@name}>
<.label for={@id}><%= @label %></.label>
<.label for={@id}>{@label}</.label>
<input
type={@type}
name={@name}
Expand All @@ -361,7 +361,7 @@ defmodule Beacon.Web.CoreComponents do
]}
{@rest}
/>
<.error :for={msg <- @errors}><%= msg %></.error>
<.error :for={msg <- @errors}>{msg}</.error>
</div>
"""
end
Expand All @@ -375,7 +375,7 @@ defmodule Beacon.Web.CoreComponents do
def label(assigns) do
~H"""
<label for={@for} class="block text-sm font-semibold leading-6 text-zinc-800">
<%= render_slot(@inner_block) %>
{render_slot(@inner_block)}
</label>
"""
end
Expand All @@ -389,7 +389,7 @@ defmodule Beacon.Web.CoreComponents do
~H"""
<p class="mt-3 flex gap-3 text-sm leading-6 text-rose-600 phx-no-feedback:hidden">
<.icon name="hero-exclamation-circle-mini" class="mt-0.5 h-5 w-5 flex-none" />
<%= render_slot(@inner_block) %>
{render_slot(@inner_block)}
</p>
"""
end
Expand All @@ -408,13 +408,13 @@ defmodule Beacon.Web.CoreComponents do
<header class={[@actions != [] && "flex items-center justify-between gap-6", @class]}>
<div>
<h1 class="text-lg font-semibold leading-8 text-zinc-800">
<%= render_slot(@inner_block) %>
{render_slot(@inner_block)}
</h1>
<p :if={@subtitle != []} class="mt-2 text-sm leading-6 text-zinc-600">
<%= render_slot(@subtitle) %>
{render_slot(@subtitle)}
</p>
</div>
<div class="flex-none"><%= render_slot(@actions) %></div>
<div class="flex-none">{render_slot(@actions)}</div>
</header>
"""
end
Expand Down Expand Up @@ -455,9 +455,9 @@ defmodule Beacon.Web.CoreComponents do
<table class="w-[40rem] mt-11 sm:w-full">
<thead class="text-sm text-left leading-6 text-zinc-500">
<tr>
<th :for={col <- @col} class="p-0 pb-4 pr-6 font-normal"><%= col[:label] %></th>
<th :for={col <- @col} class="p-0 pb-4 pr-6 font-normal">{col[:label]}</th>
<th :if={@action != []} class="relative p-0 pb-4">
<span class="sr-only"><%= gettext("Actions") %></span>
<span class="sr-only">{gettext("Actions")}</span>
</th>
</tr>
</thead>
Expand All @@ -475,15 +475,15 @@ defmodule Beacon.Web.CoreComponents do
<div class="block py-4 pr-6">
<span class="absolute -inset-y-px right-0 -left-4 group-hover:bg-zinc-50 sm:rounded-l-xl" />
<span class={["relative", i == 0 && "font-semibold text-zinc-900"]}>
<%= render_slot(col, @row_item.(row)) %>
{render_slot(col, @row_item.(row))}
</span>
</div>
</td>
<td :if={@action != []} class="relative w-14 p-0">
<div class="relative whitespace-nowrap py-4 text-right text-sm font-medium">
<span class="absolute -inset-y-px -right-4 left-0 group-hover:bg-zinc-50 sm:rounded-r-xl" />
<span :for={action <- @action} class="relative ml-4 font-semibold leading-6 text-zinc-900 hover:text-zinc-700">
<%= render_slot(action, @row_item.(row)) %>
{render_slot(action, @row_item.(row))}
</span>
</div>
</td>
Expand Down Expand Up @@ -513,8 +513,8 @@ defmodule Beacon.Web.CoreComponents do
<div class="mt-14">
<dl class="-my-4 divide-y divide-zinc-100">
<div :for={item <- @item} class="flex gap-4 py-4 text-sm leading-6 sm:gap-8">
<dt class="w-1/4 flex-none text-zinc-500"><%= item.title %></dt>
<dd class="text-zinc-700"><%= render_slot(item) %></dd>
<dt class="w-1/4 flex-none text-zinc-500">{item.title}</dt>
<dd class="text-zinc-700">{render_slot(item)}</dd>
</div>
</dl>
</div>
Expand All @@ -536,7 +536,7 @@ defmodule Beacon.Web.CoreComponents do
<div class="mt-16">
<.link navigate={@navigate} class="text-sm font-semibold leading-6 text-zinc-900 hover:text-zinc-700">
<.icon name="hero-arrow-left-solid" class="h-3 w-3" />
<%= render_slot(@inner_block) %>
{render_slot(@inner_block)}
</.link>
</div>
"""
Expand Down
2 changes: 1 addition & 1 deletion lib/beacon/web/components/layouts/app.html.heex
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<main class="px-4 py-20 sm:px-6 lg:px-8">
<div class="mx-auto max-w-6xl">
<%= @inner_content %>
{@inner_content}
</div>
</main>
2 changes: 1 addition & 1 deletion lib/beacon/web/components/layouts/dynamic.html.heex
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<Beacon.Web.CoreComponents.flash_group id="flash_group" flash={@flash} />
<%= render_dynamic_layout(assigns) %>
{render_dynamic_layout(assigns)}
10 changes: 5 additions & 5 deletions lib/beacon/web/components/layouts/runtime.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
<html lang="en" phx-socket={live_socket_path(assigns)}>
<head>
<meta name="csrf-token" content={get_csrf_token()} />
<%= render_meta_tags(assigns) %>
<%= render_schema(assigns) %>
{render_meta_tags(assigns)}
{render_schema(assigns)}
<.live_title>
<%= render_page_title(assigns) %>
{render_page_title(assigns)}
</.live_title>
<%= render_resource_links(assigns) %>
{render_resource_links(assigns)}
<link id="beacon-runtime-stylesheet" rel="stylesheet" href={asset_path(@conn, :css)} />
<script defer src={asset_path(@conn, :js)}>
</script>
</head>
<body>
<%= @inner_content %>
{@inner_content}
</body>
</html>
16 changes: 8 additions & 8 deletions lib/heroicons.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ defmodule Beacon.Heroicons do
Map.merge(%{micro: false}, assigns)
|> case do
%{mini: false, solid: false, micro: false} ->
~H"<.svg_outline {@rest}><%= {:safe, @paths[:outline]} %></.svg_outline>"
~H"<.svg_outline {@rest}>{{:safe, @paths[:outline]}}</.svg_outline>"

%{solid: true, mini: false, micro: false} ->
~H"<.svg_solid {@rest}><%= {:safe, @paths[:solid]} %></.svg_solid>"
~H"<.svg_solid {@rest}>{{:safe, @paths[:solid]}}</.svg_solid>"

%{mini: true, solid: false, micro: false} ->
~H"<.svg_mini {@rest}><%= {:safe, @paths[:mini]} %></.svg_mini>"
~H"<.svg_mini {@rest}>{{:safe, @paths[:mini]}}</.svg_mini>"

%{micro: true, solid: false, mini: false} ->
~H"<.svg_micro {@rest}><%= {:safe, @paths[:micro]} %></.svg_micro>"
~H"<.svg_micro {@rest}>{{:safe, @paths[:micro]}}</.svg_micro>"

%{} ->
raise ArgumentError, "expected either mini or solid, but got both."
Expand All @@ -41,7 +41,7 @@ defmodule Beacon.Heroicons do
defp svg_outline(assigns) do
~H"""
<svg xmlns="http://www.w3.org/2000/svg" {@rest}>
<%= render_slot(@inner_block) %>
{render_slot(@inner_block)}
</svg>
"""
end
Expand All @@ -53,7 +53,7 @@ defmodule Beacon.Heroicons do
defp svg_solid(assigns) do
~H"""
<svg xmlns="http://www.w3.org/2000/svg" {@rest}>
<%= render_slot(@inner_block) %>
{render_slot(@inner_block)}
</svg>
"""
end
Expand All @@ -65,7 +65,7 @@ defmodule Beacon.Heroicons do
defp svg_mini(assigns) do
~H"""
<svg xmlns="http://www.w3.org/2000/svg" {@rest}>
<%= render_slot(@inner_block) %>
{render_slot(@inner_block)}
</svg>
"""
end
Expand All @@ -77,7 +77,7 @@ defmodule Beacon.Heroicons do
defp svg_micro(assigns) do
~H"""
<svg xmlns="http://www.w3.org/2000/svg" {@rest}>
<%= render_slot(@inner_block) %>
{render_slot(@inner_block)}
</svg>
"""
end
Expand Down

0 comments on commit 0f97c80

Please sign in to comment.