make app responsive

This commit is contained in:
2022-02-15 23:52:44 -05:00
parent 669afd5dcb
commit d6e4090650
35 changed files with 470 additions and 422 deletions

View File

@ -7,7 +7,7 @@
let={f}
for={@changeset}
id="shot-group-form"
class="grid grid-cols-3 justify-center items-center space-y-4"
class="flex flex-col sm:grid sm:grid-cols-3 justify-center items-center space-y-4"
phx-target={@myself}
phx-change="validate"
phx-submit="save"

View File

@ -26,8 +26,11 @@ defmodule CanneryWeb.Components.InviteCard do
</h2>
<% end %>
<div class="flex flex-row justify-center items-center space-x-4">
<code id={"code-#{@invite.id}"} class="text-xs px-4 py-2 rounded-lg text-gray-100 bg-primary-800"><%= Routes.user_registration_url(Endpoint, :new, invite: @invite.token) %>
<div class="flex flex-row flex-wrap justify-center items-center">
<code
id={"code-#{@invite.id}"}
class="mx-2 my-1 text-xs px-4 py-2 rounded-lg text-center break-all text-gray-100 bg-primary-800"
><%= Routes.user_registration_url(Endpoint, :new, invite: @invite.token) %>
</code>
<%= if @code_actions do %>

View File

@ -5,7 +5,8 @@
<%= if @containers |> Enum.empty?() do %>
<h2 class="title text-xl text-primary-500">
<%= gettext("No other containers") %> <%= display_emoji("😔") %>
<%= gettext("No other containers") %>
<%= display_emoji("😔") %>
</h2>
<%= live_patch(dgettext("actions", "Add another container!"),

View File

@ -13,102 +13,105 @@ defmodule CanneryWeb.Components.Topbar do
%{results: [], title_content: nil, flash: nil, current_user: nil} |> Map.merge(assigns)
~H"""
<header class="mb-8 px-8 py-4 w-full bg-primary-400 overflow-x-hidden">
<nav role="navigation">
<div class="flex flex-row justify-between items-center space-x-4">
<div class="flex flex-row justify-start items-center space-x-2">
<%= link to: Routes.live_path(Endpoint, HomeLive) do %>
<h1 class="leading-5 text-xl text-white hover:underline">
Cannery
</h1>
<% end %>
<%= if @title_content do %>
<span>|</span>
<%= @title_content %>
<% end %>
</div>
<nav role="navigation" class="mb-8 px-8 py-4 w-full bg-primary-400">
<div class="flex flex-col sm:flex-row justify-between items-center">
<div class="mb-4 sm:mb-0 sm:mr-8 flex flex-row justify-start items-center space-x-2">
<%= link to: Routes.live_path(Endpoint, HomeLive) do %>
<h1 class="mx-2 my-1 leading-5 text-xl text-white hover:underline">
Cannery
</h1>
<% end %>
<ul class="flex flex-col sm:flex-row flex-wrap justify-center items-center
space-x-4 text-lg text-white text-ellipsis">
<%= if @current_user do %>
<li>
<%= link(gettext("Tags"),
<%= if @title_content do %>
<span class="mx-2 my-1">
|
</span>
<%= @title_content %>
<% end %>
</div>
<hr class="mb-2 sm:hidden hr-light">
<ul class="flex flex-row flex-wrap justify-center items-center
text-lg text-white text-ellipsis">
<%= if @current_user do %>
<li class="mx-2 my-1">
<%= link(gettext("Tags"),
class: "hover:underline",
to: Routes.tag_index_path(Endpoint, :index)
) %>
</li>
<li class="mx-2 my-1">
<%= link(gettext("Containers"),
class: "hover:underline",
to: Routes.container_index_path(Endpoint, :index)
) %>
</li>
<li class="mx-2 my-1">
<%= link(gettext("Ammo"),
class: "hover:underline",
to: Routes.ammo_type_index_path(Endpoint, :index)
) %>
</li>
<li class="mx-2 my-1">
<%= link(gettext("Manage"),
class: "hover:underline",
to: Routes.ammo_group_index_path(Endpoint, :index)
) %>
</li>
<li class="mx-2 my-1">
<%= link(gettext("Range"),
class: "hover:underline",
to: Routes.range_index_path(Endpoint, :index)
) %>
</li>
<%= if @current_user.role == :admin do %>
<li class="mx-2 my-1">
<%= link(gettext("Invites"),
class: "hover:underline",
to: Routes.tag_index_path(Endpoint, :index)
to: Routes.invite_index_path(Endpoint, :index)
) %>
</li>
<li>
<%= link(gettext("Containers"),
class: "hover:underline",
to: Routes.container_index_path(Endpoint, :index)
) %>
</li>
<li>
<%= link(gettext("Ammo"),
class: "hover:underline",
to: Routes.ammo_type_index_path(Endpoint, :index)
) %>
</li>
<li>
<%= link(gettext("Manage"),
class: "hover:underline",
to: Routes.ammo_group_index_path(Endpoint, :index)
) %>
</li>
<li>
<%= link(gettext("Range"),
class: "hover:underline",
to: Routes.range_index_path(Endpoint, :index)
) %>
</li>
<%= if @current_user.role == :admin do %>
<li>
<%= link(gettext("Invites"),
class: "hover:underline",
to: Routes.invite_index_path(Endpoint, :index)
) %>
</li>
<% end %>
<li class="mx-2 my-1">
<%= link(@current_user.email,
class: "hover:underline truncate",
to: Routes.user_settings_path(Endpoint, :edit)
) %>
</li>
<li class="mx-2 my-1">
<%= link to: Routes.user_session_path(Endpoint, :delete),
method: :delete,
data: [confirm: dgettext("prompts", "Are you sure you want to log out?")] do %>
<i class="fas fa-sign-out-alt"></i>
<% end %>
<li>
<%= link(@current_user.email,
class: "hover:underline truncate",
to: Routes.user_settings_path(Endpoint, :edit)
) %>
</li>
<li>
<%= link to: Routes.user_session_path(Endpoint, :delete),
method: :delete,
data: [confirm: dgettext("prompts", "Are you sure you want to log out?")] do %>
<i class="fas fa-sign-out-alt"></i>
</li>
<%= if @current_user.role == :admin and function_exported?(Routes, :live_dashboard_path, 2) do %>
<li class="mx-2 my-1">
<%= link to: Routes.live_dashboard_path(Endpoint, :home) do %>
<i class="fas fa-tachometer-alt"></i>
<% end %>
</li>
<%= if @current_user.role == :admin and function_exported?(Routes, :live_dashboard_path, 2) do %>
<li>
<%= link to: Routes.live_dashboard_path(Endpoint, :home) do %>
<i class="fas fa-tachometer-alt"></i>
<% end %>
</li>
<% end %>
<% else %>
<%= if Accounts.allow_registration?() do %>
<li>
<%= link(dgettext("actions", "Register"),
class: "hover:underline",
to: Routes.user_registration_path(Endpoint, :new)
) %>
</li>
<% end %>
<li>
<%= link(dgettext("actions", "Log in"),
<% end %>
<% else %>
<%= if Accounts.allow_registration?() do %>
<li class="mx-2 my-1">
<%= link(dgettext("actions", "Register"),
class: "hover:underline",
to: Routes.user_session_path(Endpoint, :new)
to: Routes.user_registration_path(Endpoint, :new)
) %>
</li>
<% end %>
</ul>
</div>
</nav>
</header>
<li class="mx-2 my-1">
<%= link(dgettext("actions", "Log in"),
class: "hover:underline",
to: Routes.user_session_path(Endpoint, :new)
) %>
</li>
<% end %>
</ul>
</div>
</nav>
"""
end
end

View File

@ -13,7 +13,7 @@ defmodule CanneryWeb.Components.UserCard do
border border-gray-400 rounded-lg shadow-lg hover:shadow-md
transition-all duration-300 ease-in-out"
>
<h1 class="px-4 py-2 rounded-lg title text-xl">
<h1 class="px-4 py-2 rounded-lg title text-xl break-all">
<%= @user.email %>
</h1>