Skip to content

Commit

Permalink
mix format
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Dec 11, 2024
1 parent 402de68 commit d646bd7
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 38 deletions.
56 changes: 28 additions & 28 deletions lib/cal_web/components/core_components.ex
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ defmodule CalWeb.CoreComponents do
</button>
</div>
<div id={"#{@id}-content"}>
<%= render_slot(@inner_block) %>
{render_slot(@inner_block)}
</div>
</.focus_wrap>
</div>
Expand Down Expand Up @@ -122,9 +122,9 @@ defmodule CalWeb.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 @@ -185,9 +185,9 @@ defmodule CalWeb.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 @@ -219,7 +219,7 @@ defmodule CalWeb.CoreComponents do
]}
{@rest}
>
<%= render_slot(@inner_block) %>
{render_slot(@inner_block)}
</button>
"""
end
Expand Down Expand Up @@ -287,36 +287,36 @@ defmodule CalWeb.CoreComponents do
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-1 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 @@ -328,7 +328,7 @@ defmodule CalWeb.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 @@ -337,7 +337,7 @@ defmodule CalWeb.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 @@ -351,7 +351,7 @@ defmodule CalWeb.CoreComponents do
]}
{@rest}
/>
<.error :for={msg <- @errors}><%= msg %></.error>
<.error :for={msg <- @errors}>{msg}</.error>
</div>
"""
end
Expand All @@ -365,7 +365,7 @@ defmodule CalWeb.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 @@ -379,7 +379,7 @@ defmodule CalWeb.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 @@ -398,13 +398,13 @@ defmodule CalWeb.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 @@ -445,8 +445,8 @@ defmodule CalWeb.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 pr-6 pb-4 font-normal"><%= col[:label] %></th>
<th class="relative p-0 pb-4"><span class="sr-only"><%= gettext("Actions") %></span></th>
<th :for={col <- @col} class="p-0 pr-6 pb-4 font-normal">{col[:label]}</th>
<th class="relative p-0 pb-4"><span class="sr-only">{gettext("Actions")}</span></th>
</tr>
</thead>
<tbody
Expand All @@ -463,7 +463,7 @@ defmodule CalWeb.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 @@ -474,7 +474,7 @@ defmodule CalWeb.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 @@ -504,8 +504,8 @@ defmodule CalWeb.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 @@ -530,7 +530,7 @@ defmodule CalWeb.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/cal_web/components/layouts/app.html.heex
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<.flash_group flash={@flash} />
<%= @inner_content %>
{@inner_content}
4 changes: 2 additions & 2 deletions lib/cal_web/components/layouts/root.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="csrf-token" content={get_csrf_token()} />
<.live_title suffix=" · Phoenix Framework">
<%= assigns[:page_title] || "Cal" %>
{assigns[:page_title] || "Cal"}
</.live_title>
<link phx-track-static rel="stylesheet" href={~p"/assets/app.css"} />
<script defer phx-track-static type="text/javascript" src={~p"/assets/app.js"}>
Expand All @@ -14,6 +14,6 @@
</script>
</head>
<body class="bg-white antialiased">
<%= @inner_content %>
{@inner_content}
</body>
</html>
14 changes: 7 additions & 7 deletions lib/cal_web/live/app_live.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
<div class="relative mt-4 block h-fit w-full overflow-hidden rounded-lg border border-gray-100">
<div class="flex flex-row">
<div class="flex w-14 flex-col items-center justify-center bg-red-700 py-2 pl-3 pr-3 text-white">
<h3 class="text-xs"><%= render_date(event).month %></h3>
<h3 class="text-2xl font-bold"><%= render_date(event).day %></h3>
<h3 class="text-xs"><%= render_date(event).year %></h3>
<h3 class="text-xs">{render_date(event).month}</h3>
<h3 class="text-2xl font-bold">{render_date(event).day}</h3>
<h3 class="text-xs">{render_date(event).year}</h3>
</div>

<div class="ml-5 pb-2 pr-2 pt-2">
<div class="sm:flex sm:justify-between sm:gap-4">
<h3 class="text-lg font-bold text-gray-900 sm:text-xl">
<span class="mr-3"><%= Map.get(event, :summary) %></span>
<span class="mr-3">{Map.get(event, :summary)}</span>
<span class="rounded-full border border-indigo-500 px-3 py-1 text-xs text-indigo-500">
<span class="font-bold"><%= render_start_end_times(event) %></span>
<span class="font-bold">{render_start_end_times(event)}</span>
</span>
</h3>
</div>
Expand All @@ -30,8 +30,8 @@
<p class="w-full text-sm text-gray-500">
<span>Organized by: </span>
<span class="font-bold">
<%= Map.get(event, :organizer) |> Map.get(:displayName) ||
Map.get(event, :organizer) |> Map.get(:email) %>
{Map.get(event, :organizer) |> Map.get(:displayName) ||
Map.get(event, :organizer) |> Map.get(:email)}
</span>
</p>
</div>
Expand Down

0 comments on commit d646bd7

Please sign in to comment.