Skip to content

Commit

Permalink
mix format
Browse files Browse the repository at this point in the history
  • Loading branch information
LostKobrakai committed Dec 15, 2024
1 parent fe89b8c commit 8c69ca2
Show file tree
Hide file tree
Showing 16 changed files with 71 additions and 71 deletions.
6 changes: 3 additions & 3 deletions lib/kobrakai_web/components/components.ex
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ defmodule KobrakaiWeb.Components do
|> assign(:length, length(list))

~H"""
<%= render_slot(@inner_block, @rendered) %>
{render_slot(@inner_block, @rendered)}
<%= if @length > abs(@max) && @link != [] do %>
<%= render_slot(@link, @length) %>
{render_slot(@link, @length)}
<% end %>
"""
end
Expand Down Expand Up @@ -152,6 +152,6 @@ defmodule KobrakaiWeb.Components do

assigns = assign(assigns, formatted: formatted)

~H"<data value={@stat}><%= @formatted %></data>"
~H"<data value={@stat}>{@formatted}</data>"
end
end
60 changes: 30 additions & 30 deletions lib/kobrakai_web/components/core_components.ex
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ defmodule KobrakaiWeb.CoreComponents do
</button>
</div>
<div id={"#{@id}-content"}>
<%= render_slot(@inner_block) %>
{render_slot(@inner_block)}
</div>
</.focus_wrap>
</div>
Expand Down Expand Up @@ -124,9 +124,9 @@ defmodule KobrakaiWeb.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 @@ -157,7 +157,7 @@ defmodule KobrakaiWeb.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 @@ -169,7 +169,7 @@ defmodule KobrakaiWeb.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 @@ -203,9 +203,9 @@ defmodule KobrakaiWeb.CoreComponents do
~H"""
<.form :let={f} for={@for} as={@as} {@rest}>
<div class="mt-10 space-y-8">
<%= 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 @@ -238,7 +238,7 @@ defmodule KobrakaiWeb.CoreComponents do
]}
{@rest}
>
<%= render_slot(@inner_block) %>
{render_slot(@inner_block)}
</button>
"""
end
Expand Down Expand Up @@ -324,36 +324,36 @@ defmodule KobrakaiWeb.CoreComponents do
class="rounded border-zinc-300 text-zinc-900 focus:ring-0 dark:border-zinc-700"
{@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>
<.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>
<.label for={@id}><%= @label %></.label>
<.label for={@id}>{@label}</.label>
<textarea
id={@id}
name={@name}
Expand All @@ -365,7 +365,7 @@ defmodule KobrakaiWeb.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 @@ -374,7 +374,7 @@ defmodule KobrakaiWeb.CoreComponents do
def input(assigns) do
~H"""
<div>
<.label for={@id}><%= @label %></.label>
<.label for={@id}>{@label}</.label>
<input
type={@type}
name={@name}
Expand All @@ -388,7 +388,7 @@ defmodule KobrakaiWeb.CoreComponents do
]}
{@rest}
/>
<.error :for={msg <- @errors}><%= msg %></.error>
<.error :for={msg <- @errors}>{msg}</.error>
</div>
"""
end
Expand All @@ -402,7 +402,7 @@ defmodule KobrakaiWeb.CoreComponents do
def label(assigns) do
~H"""
<label for={@for} class="block text-sm font-semibold leading-6 text-zinc-800 dark:text-zinc-200">
<%= render_slot(@inner_block) %>
{render_slot(@inner_block)}
</label>
"""
end
Expand All @@ -416,7 +416,7 @@ defmodule KobrakaiWeb.CoreComponents do
~H"""
<p class="mt-3 flex gap-3 text-sm leading-6 text-rose-600">
<.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 @@ -435,13 +435,13 @@ defmodule KobrakaiWeb.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 @@ -482,9 +482,9 @@ defmodule KobrakaiWeb.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 @@ -502,7 +502,7 @@ defmodule KobrakaiWeb.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>
Expand All @@ -513,7 +513,7 @@ defmodule KobrakaiWeb.CoreComponents do
: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 @@ -543,8 +543,8 @@ defmodule KobrakaiWeb.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 @@ -569,7 +569,7 @@ defmodule KobrakaiWeb.CoreComponents do
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/kobrakai_web/components/layouts/app.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="2xl:mt-24">
<.flash_group flash={@flash} />
<main>
<%= @inner_content %>
{@inner_content}
</main>
<footer class="text-center mt-24 pb-16 print:hidden">
<.link
Expand Down
4 changes: 2 additions & 2 deletions lib/kobrakai_web/components/layouts/root.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<KobrakaiWeb.OpenGraph.render og={@og} />

<.live_title suffix=" | Benjamin Milde">
<%= get_in(assigns.og.title) || assigns[:page_title] %>
{get_in(assigns.og.title) || assigns[:page_title]}
</.live_title>

<link rel="icon" href="/favicon.ico" sizes="any" />
Expand Down Expand Up @@ -42,6 +42,6 @@
</script>
</head>
<body class="container mx-auto p-4 max-w-screen-xl dark:bg-[#111] dark:text-gray-100">
<%= @inner_content %>
{@inner_content}
</body>
</html>
20 changes: 10 additions & 10 deletions lib/kobrakai_web/live/scratchpad/table.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,30 @@ defmodule KobrakaiWeb.Scratchpad.Table do
<h2>Adjusted tables</h2>
<div class="p-8">
<.adjusted_table id="users-1" rows={@rows}>
<:col :let={user} label="id"><%= user.id %></:col>
<:col :let={user} label="username"><%= user.username %><br />Multiline</:col>
<:col :let={user} label="id">{user.id}</:col>
<:col :let={user} label="username">{user.username}<br />Multiline</:col>
<:action>Action 1</:action>
<:action>Action 2</:action>
</.adjusted_table>
</div>
<div class="p-8">
<.adjusted_table id="users-2" rows={@rows}>
<:col :let={user} label="id"><%= user.id %></:col>
<:col :let={user} label="id">{user.id}</:col>
</.adjusted_table>
</div>
<hr />
<h2>Phoenix tables</h2>
<div class="p-8">
<.table id="users-1" rows={@rows}>
<:col :let={user} label="id"><%= user.id %></:col>
<:col :let={user} label="username"><%= user.username %><br />Multiline</:col>
<:col :let={user} label="id">{user.id}</:col>
<:col :let={user} label="username">{user.username}<br />Multiline</:col>
<:action>Action 1</:action>
<:action>Action 2</:action>
</.table>
</div>
<div class="p-8">
<.table id="users-2" rows={@rows}>
<:col :let={user} label="id"><%= user.id %></:col>
<:col :let={user} label="id">{user.id}</:col>
</.table>
</div>
<hr />
Expand Down Expand Up @@ -81,10 +81,10 @@ defmodule KobrakaiWeb.Scratchpad.Table do
<thead class="text-left text-[0.8125rem] leading-6 text-zinc-500">
<tr>
<th :for={col <- @col} class="p-0 pb-4 pr-6 font-normal" scope="col">
<%= col[:label] %>
{col[:label]}
</th>
<th :if={@action != []} class="relative p-0 pb-4" scope="col">
<span class="sr-only"><%= gettext("Actions") %></span>
<span class="sr-only">{gettext("Actions")}</span>
</th>
</tr>
</thead>
Expand All @@ -108,14 +108,14 @@ defmodule KobrakaiWeb.Scratchpad.Table do
>
<div class="block py-4 pr-6">
<span class={["relative", i == 0 && "font-semibold text-zinc-900"]}>
<%= render_slot(col, row) %>
{render_slot(col, row)}
</span>
</div>
</.dynamic_tag>
<td :if={@action != []} class={["p-0 w-14 relative", rounded_end()]}>
<div class="whitespace-nowrap py-4 text-right text-sm font-semibold leading-6 text-zinc-900 flex gap-4">
<span :for={action <- @action} class="relative hover:text-zinc-700">
<%= render_slot(action, row) %>
{render_slot(action, row)}
</span>
</div>
</td>
Expand Down
6 changes: 3 additions & 3 deletions lib/kobrakai_web/views/blog_html.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defmodule KobrakaiWeb.BlogHTML do
def index(assigns) do
~H"""
<div>
<h2 class="uppercase mb-6"><%= @og.title %></h2>
<h2 class="uppercase mb-6">{@og.title}</h2>
<div class="sm:columns-2 lg:columns-3">
<ol class="-my-4">
<KobrakaiWeb.PageHTML.list_item
Expand All @@ -32,9 +32,9 @@ defmodule KobrakaiWeb.BlogHTML do
<%= for p <- @parts do %>
<%= case p do %>
<% {:live, live} -> %>
<%= live_render(@conn, Module.concat([live])) %>
{live_render(@conn, Module.concat([live]))}
<% {:html, html} -> %>
<%= Phoenix.HTML.raw(html) %>
{Phoenix.HTML.raw(html)}
<% end %>
<% end %>
"""
Expand Down
4 changes: 2 additions & 2 deletions lib/kobrakai_web/views/blog_html/show.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
class="text-gray-500 dark:text-gray-400 text-sm"
datetime={Calendar.strftime(@post.date, "%Y-%m-%d")}
>
<%= Calendar.strftime(@post.date, "%d.%m.%Y") %>
{Calendar.strftime(@post.date, "%d.%m.%Y")}
</time>
<h1 class="uppercase text-3xl mb-2"><%= @post.headline || @post.title %></h1>
<h1 class="uppercase text-3xl mb-2">{@post.headline || @post.title}</h1>
</div>
<div class="prose max-w-none dark:prose-invert">
<.body conn={@conn} content={@post.body} />
Expand Down
6 changes: 3 additions & 3 deletions lib/kobrakai_web/views/page_html.ex
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ defmodule KobrakaiWeb.PageHTML do
<li class={["my-2 group", @class]} style="break-inside: avoid;" {@rest}>
<.link navigate={@url}>
<div>
<%= @headline %>
{@headline}
<.arrow />
</div>
<div class="text-gray-500 dark:text-gray-400 text-sm">
<%= Calendar.strftime(@date, "%d.%m.%Y") %>
{Calendar.strftime(@date, "%d.%m.%Y")}
<%= unless Enum.empty?(@tags) do %>
&mdash;
<ul class="comma-separated inline-flex">
<li :for={tag <- @tags}><%= String.capitalize(tag) %></li>
<li :for={tag <- @tags}>{String.capitalize(tag)}</li>
</ul>
<% end %>
</div>
Expand Down
4 changes: 2 additions & 2 deletions lib/kobrakai_web/views/page_html/home.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<:link :let={length}>
<li class="group opacity-0 animate-in animation-fill-mode-forwards animation-delay-495">
<.link navigate={~p"/projekte"}>
Alle Projekte (<%= length %>) <.arrow />
Alle Projekte ({length}) <.arrow />
</.link>
</li>
</:link>
Expand All @@ -42,7 +42,7 @@
<:link :let={length}>
<li class="group opacity-0 animate-in animation-fill-mode-forwards animation-delay-495">
<.link navigate={~p"/kolumne"}>
Alle Posts (<%= length %>) <.arrow />
Alle Posts ({length}) <.arrow />
</.link>
</li>
</:link>
Expand Down
Loading

0 comments on commit 8c69ca2

Please sign in to comment.