Skip to content

Commit 04c3184

Browse files
committed
feat: mobile sidebar
1 parent 00ef3b2 commit 04c3184

File tree

4 files changed

+55
-8
lines changed

4 files changed

+55
-8
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.env
22
.env.*
33
!.env.*.sample
4+
.envrc
45

56
# The directory Mix will write compiled artifacts to.
67
/_build/

lib/cesium_link_web/components/core_components.ex

+1-1
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ defmodule CesiumLinkWeb.CoreComponents do
443443
end
444444

445445
~H"""
446-
<div class="overflow-y-auto px-4 sm:overflow-visible sm:px-0">
446+
<div class="overflow-x-auto overflow-y-hidden px-4 sm:overflow-visible sm:px-0">
447447
<table class="w-[40rem] mt-11 sm:w-full">
448448
<thead class="text-left text-sm leading-6 text-zinc-500">
449449
<tr>

lib/cesium_link_web/components/layouts/app.html.heex

+52-7
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
<header class="px-4 sm:px-6 lg:px-8">
2-
<div class="flex items-center justify-between border-b border-zinc-100 py-3 text-sm">
2+
<div class="hidden sm:flex items-center justify-between border-b border-zinc-100 py-3 text-sm">
3+
<!-- Navbar (desktop) -->
34
<div class="flex items-center gap-4">
4-
<a href="/">
5+
<.link navigate="/">
56
<img src={~p"/images/cesium-link.svg"} width="150" />
6-
</a>
7+
</.link>
78
<ul class="relative z-10 flex items-center gap-2 sm:gap-8 px-4 sm:px-6 lg:px-8 justify-end">
89
<li>
9-
<.link href={~p"/admin/links"} class="text-[0.8125rem] leading-6 text-zinc-900 font-semibold hover:text-zinc-700 flex gap-1">
10+
<.link patch={~p"/admin/links"} class="text-[0.8125rem] leading-6 text-zinc-900 font-semibold hover:text-zinc-700 flex gap-1">
1011
<.icon name="hero-link" class="w-4 h-4 self-center" /> Links
1112
</.link>
1213
</li>
1314
<li>
14-
<.link href={~p"/admin/redirects"} class="text-[0.8125rem] leading-6 text-zinc-900 font-semibold hover:text-zinc-700 flex gap-1">
15+
<.link patch={~p"/admin/redirects"} class="text-[0.8125rem] leading-6 text-zinc-900 font-semibold hover:text-zinc-700 flex gap-1">
1516
<.icon name="hero-arrow-uturn-right" class="w-4 h-4 self-center" /> Redirects
1617
</.link>
1718
</li>
1819
<li>
19-
<.link href={~p"/admin/qrcode"} class="text-[0.8125rem] leading-6 text-zinc-900 font-semibold hover:text-zinc-700 flex gap-1">
20+
<.link patch={~p"/admin/qrcode"} class="text-[0.8125rem] leading-6 text-zinc-900 font-semibold hover:text-zinc-700 flex gap-1">
2021
<.icon name="hero-qr-code" class="w-4 h-4 self-center" /> QR Generator
2122
</.link>
2223
</li>
@@ -33,8 +34,52 @@
3334
<% end %>
3435
</div>
3536
</div>
37+
<!-- Sidebar (mobile) -->
38+
<div class="sm:hidden flex flex-row-reverse items-center justify-between border-b border-zinc-100 py-2 text-sm">
39+
<button type="button" class="text-zinc-900 hover:text-zinc-700" phx-click={JS.show(to: "#mobile-sidebar-container") |> JS.show(to: "#mobile-sidebar")}>
40+
<.icon name="hero-bars-3" class="w-7 h-7" />
41+
</button>
42+
</div>
3643
</header>
37-
<main class="px-4 py-20 sm:px-6 lg:px-8">
44+
<div id="mobile-sidebar-container" class="fixed inset-0 flex z-40 lg:hidden" aria-modal="true" style="display: none;">
45+
<div class="fixed inset-0 bg-gray-600 bg-opacity-75" phx-click={JS.hide(to: "#mobile-sidebar-container")}></div>
46+
47+
<div id="mobile-sidebar" class="relative flex-1 flex flex-col max-w-xs w-full pt-5 pb-4 bg-white min-h-screen h-full">
48+
<div class="flex flex-col h-full py-4 overflow-y-auto scrollbar-hide">
49+
<.link navigate="/" class="flex-shrink-0 flex items-center pt-4 px-16">
50+
<img src={~p"/images/cesium-link.svg"} />
51+
</.link>
52+
<ul class="flex flex-col gap-4 pl-6 pt-8 h-full">
53+
<li>
54+
<.link patch={~p"/admin/links"} class="text-md leading-6 text-zinc-900 font-semibold hover:text-zinc-700 flex gap-1">
55+
<.icon name="hero-link" class="w-4 h-4 self-center" /> Links
56+
</.link>
57+
</li>
58+
<li>
59+
<.link patch={~p"/admin/redirects"} class="text-md leading-6 text-zinc-900 font-semibold hover:text-zinc-700 flex gap-1">
60+
<.icon name="hero-arrow-uturn-right" class="w-4 h-4 self-center" /> Redirects
61+
</.link>
62+
</li>
63+
<li>
64+
<.link patch={~p"/admin/qrcode"} class="text-md leading-6 text-zinc-900 font-semibold hover:text-zinc-700 flex gap-1">
65+
<.icon name="hero-qr-code" class="w-4 h-4 self-center" /> QR Generator
66+
</.link>
67+
</li>
68+
<li :if={@current_user} class="mt-auto">
69+
<div class="flex gap-x-4 py-4">
70+
<p class="text-md leading-6 text-zinc-900">
71+
<%= @current_user.email %>
72+
</p>
73+
<.link href={~p"/users/log_out"} method="delete" class="text-md leading-6 text-zinc-900 font-semibold hover:text-zinc-700">
74+
<.icon name="hero-arrow-left-start-on-rectangle" />
75+
</.link>
76+
</div>
77+
</li>
78+
</ul>
79+
</div>
80+
</div>
81+
</div>
82+
<main class="px-4 py-4 sm:py-20 sm:px-6 lg:px-8">
3883
<div class="mx-auto">
3984
<.flash_group flash={@flash} />
4085
<%= @inner_content %>

lib/mix/tasks/convert.ex

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
defmodule Mix.Tasks.Convert do
22
@moduledoc """
33
Task to read data exported (in CSV files, one for each table) from the old cesium.link project and import it to database following the new schemas.
4+
Takes in 3 files as arguments in the following order: links, redirects, forms.
45
"""
56
use Mix.Task
67

0 commit comments

Comments
 (0)