From 5e5267210b0aa574a1b549208248901971a312fe Mon Sep 17 00:00:00 2001 From: Florian Briand Date: Sun, 4 Aug 2024 20:40:09 +0200 Subject: [PATCH] feat: add navbar layout with some JS controls (with Alpine.js) --- crates/app/assets/css/style.css | 551 +++++++++++++++++- crates/app/templates/base.html | 13 +- crates/app/templates/index.html | 32 +- crates/app/templates/layout/nav.html | 41 ++ .../layout/nav/desktop/menu-items.html | 22 + .../nav/desktop/notifications-button.html | 6 + .../layout/nav/desktop/profile-dropdown.html | 73 +++ .../templates/layout/nav/desktop/profile.html | 23 + crates/app/templates/layout/nav/logo.html | 4 + .../layout/nav/mobile/menu-button.html | 43 ++ .../layout/nav/mobile/menu-items.html | 22 + .../nav/mobile/notifications-button.html | 6 + .../layout/nav/mobile/profile-items.html | 15 + .../templates/layout/nav/mobile/profile.html | 11 + .../layout/nav/notifications-icon.html | 16 + 15 files changed, 859 insertions(+), 19 deletions(-) create mode 100644 crates/app/templates/layout/nav.html create mode 100644 crates/app/templates/layout/nav/desktop/menu-items.html create mode 100644 crates/app/templates/layout/nav/desktop/notifications-button.html create mode 100644 crates/app/templates/layout/nav/desktop/profile-dropdown.html create mode 100644 crates/app/templates/layout/nav/desktop/profile.html create mode 100644 crates/app/templates/layout/nav/logo.html create mode 100644 crates/app/templates/layout/nav/mobile/menu-button.html create mode 100644 crates/app/templates/layout/nav/mobile/menu-items.html create mode 100644 crates/app/templates/layout/nav/mobile/notifications-button.html create mode 100644 crates/app/templates/layout/nav/mobile/profile-items.html create mode 100644 crates/app/templates/layout/nav/mobile/profile.html create mode 100644 crates/app/templates/layout/nav/notifications-icon.html diff --git a/crates/app/assets/css/style.css b/crates/app/assets/css/style.css index aec94d4..5cc58ac 100644 --- a/crates/app/assets/css/style.css +++ b/crates/app/assets/css/style.css @@ -554,19 +554,566 @@ video { --tw-contain-style: ; } +.sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border-width: 0; +} + +.visible { + visibility: visible; +} + +.absolute { + position: absolute; +} + +.relative { + position: relative; +} + +.-inset-0\.5 { + inset: -0.125rem; +} + +.-inset-1\.5 { + inset: -0.375rem; +} + +.inset-y-0 { + top: 0px; + bottom: 0px; +} + +.left-0 { + left: 0px; +} + +.right-0 { + right: 0px; +} + +.z-10 { + z-index: 10; +} + +.mx-auto { + margin-left: auto; + margin-right: auto; +} + +.ml-3 { + margin-left: 0.75rem; +} + +.mt-2 { + margin-top: 0.5rem; +} + +.-mr-2 { + margin-right: -0.5rem; +} + +.ml-auto { + margin-left: auto; +} + +.mt-3 { + margin-top: 0.75rem; +} + .block { display: block; } +.flex { + display: flex; +} + +.inline-flex { + display: inline-flex; +} + +.hidden { + display: none; +} + +.h-16 { + height: 4rem; +} + +.h-6 { + height: 1.5rem; +} + +.h-8 { + height: 2rem; +} + +.h-full { + height: 100%; +} + +.h-10 { + height: 2.5rem; +} + +.min-h-full { + min-height: 100%; +} + +.w-48 { + width: 12rem; +} + +.w-6 { + width: 1.5rem; +} + +.w-8 { + width: 2rem; +} + +.w-auto { + width: auto; +} + +.w-10 { + width: 2.5rem; +} + +.max-w-7xl { + max-width: 80rem; +} + +.max-w-xs { + max-width: 20rem; +} + +.flex-1 { + flex: 1 1 0%; +} + +.flex-shrink-0 { + flex-shrink: 0; +} + +.origin-top-right { + transform-origin: top right; +} + +.scale-100 { + --tw-scale-x: 1; + --tw-scale-y: 1; + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); +} + +.scale-95 { + --tw-scale-x: .95; + --tw-scale-y: .95; + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); +} + +.transform { + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); +} + +.items-center { + align-items: center; +} + +.justify-center { + justify-content: center; +} + +.justify-between { + justify-content: space-between; +} + +.space-y-1 > :not([hidden]) ~ :not([hidden]) { + --tw-space-y-reverse: 0; + margin-top: calc(0.25rem * calc(1 - var(--tw-space-y-reverse))); + margin-bottom: calc(0.25rem * var(--tw-space-y-reverse)); +} + +.rounded-full { + border-radius: 9999px; +} + +.rounded-md { + border-radius: 0.375rem; +} + +.border-b-2 { + border-bottom-width: 2px; +} + +.border-l-4 { + border-left-width: 4px; +} + +.border-b { + border-bottom-width: 1px; +} + +.border-t { + border-top-width: 1px; +} + +.border-indigo-500 { + --tw-border-opacity: 1; + border-color: rgb(99 102 241 / var(--tw-border-opacity)); +} + +.border-transparent { + border-color: transparent; +} + +.border-gray-200 { + --tw-border-opacity: 1; + border-color: rgb(229 231 235 / var(--tw-border-opacity)); +} + +.bg-gray-100 { + --tw-bg-opacity: 1; + background-color: rgb(243 244 246 / var(--tw-bg-opacity)); +} + +.bg-indigo-50 { + --tw-bg-opacity: 1; + background-color: rgb(238 242 255 / var(--tw-bg-opacity)); +} + +.bg-white { + --tw-bg-opacity: 1; + background-color: rgb(255 255 255 / var(--tw-bg-opacity)); +} + +.p-1 { + padding: 0.25rem; +} + +.p-2 { + padding: 0.5rem; +} + +.px-1 { + padding-left: 0.25rem; + padding-right: 0.25rem; +} + +.px-2 { + padding-left: 0.5rem; + padding-right: 0.5rem; +} + +.px-4 { + padding-left: 1rem; + padding-right: 1rem; +} + +.py-1 { + padding-top: 0.25rem; + padding-bottom: 0.25rem; +} + +.py-10 { + padding-top: 2.5rem; + padding-bottom: 2.5rem; +} + +.py-2 { + padding-top: 0.5rem; + padding-bottom: 0.5rem; +} + +.py-8 { + padding-top: 2rem; + padding-bottom: 2rem; +} + +.pb-4 { + padding-bottom: 1rem; +} + +.pl-3 { + padding-left: 0.75rem; +} + +.pr-2 { + padding-right: 0.5rem; +} + +.pr-4 { + padding-right: 1rem; +} + +.pt-1 { + padding-top: 0.25rem; +} + +.pt-2 { + padding-top: 0.5rem; +} + +.pb-3 { + padding-bottom: 0.75rem; +} + +.pt-4 { + padding-top: 1rem; +} + .text-3xl { font-size: 1.875rem; line-height: 2.25rem; } +.text-base { + font-size: 1rem; + line-height: 1.5rem; +} + +.text-sm { + font-size: 0.875rem; + line-height: 1.25rem; +} + .font-bold { font-weight: 700; } -.underline { - text-decoration-line: underline; +.font-medium { + font-weight: 500; +} + +.leading-tight { + line-height: 1.25; +} + +.tracking-tight { + letter-spacing: -0.025em; +} + +.text-gray-400 { + --tw-text-opacity: 1; + color: rgb(156 163 175 / var(--tw-text-opacity)); +} + +.text-gray-500 { + --tw-text-opacity: 1; + color: rgb(107 114 128 / var(--tw-text-opacity)); +} + +.text-gray-700 { + --tw-text-opacity: 1; + color: rgb(55 65 81 / var(--tw-text-opacity)); +} + +.text-gray-900 { + --tw-text-opacity: 1; + color: rgb(17 24 39 / var(--tw-text-opacity)); +} + +.text-indigo-700 { + --tw-text-opacity: 1; + color: rgb(67 56 202 / var(--tw-text-opacity)); +} + +.text-gray-600 { + --tw-text-opacity: 1; + color: rgb(75 85 99 / var(--tw-text-opacity)); +} + +.text-gray-800 { + --tw-text-opacity: 1; + color: rgb(31 41 55 / var(--tw-text-opacity)); +} + +.opacity-0 { + opacity: 0; +} + +.opacity-100 { + opacity: 1; +} + +.shadow { + --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1); + --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color); + box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); +} + +.shadow-lg { + --tw-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); + --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color); + box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); +} + +.ring-1 { + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); +} + +.ring-black { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(0 0 0 / var(--tw-ring-opacity)); +} + +.ring-opacity-5 { + --tw-ring-opacity: 0.05; +} + +.transition { + transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter; + transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter; + transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter; + transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); + transition-duration: 150ms; +} + +.duration-200 { + transition-duration: 200ms; +} + +.duration-75 { + transition-duration: 75ms; +} + +.ease-in { + transition-timing-function: cubic-bezier(0.4, 0, 1, 1); +} + +.ease-out { + transition-timing-function: cubic-bezier(0, 0, 0.2, 1); +} + +.hover\:border-gray-300:hover { + --tw-border-opacity: 1; + border-color: rgb(209 213 219 / var(--tw-border-opacity)); +} + +.hover\:bg-gray-100:hover { + --tw-bg-opacity: 1; + background-color: rgb(243 244 246 / var(--tw-bg-opacity)); +} + +.hover\:bg-gray-50:hover { + --tw-bg-opacity: 1; + background-color: rgb(249 250 251 / var(--tw-bg-opacity)); +} + +.hover\:text-gray-500:hover { + --tw-text-opacity: 1; + color: rgb(107 114 128 / var(--tw-text-opacity)); +} + +.hover\:text-gray-700:hover { + --tw-text-opacity: 1; + color: rgb(55 65 81 / var(--tw-text-opacity)); +} + +.hover\:text-gray-800:hover { + --tw-text-opacity: 1; + color: rgb(31 41 55 / var(--tw-text-opacity)); +} + +.focus\:outline-none:focus { + outline: 2px solid transparent; + outline-offset: 2px; +} + +.focus\:ring-2:focus { + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); +} + +.focus\:ring-inset:focus { + --tw-ring-inset: inset; +} + +.focus\:ring-indigo-500:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(99 102 241 / var(--tw-ring-opacity)); +} + +.focus\:ring-offset-2:focus { + --tw-ring-offset-width: 2px; +} + +@media (min-width: 640px) { + .sm\:static { + position: static; + } + + .sm\:inset-auto { + inset: auto; + } + + .sm\:-my-px { + margin-top: -1px; + margin-bottom: -1px; + } + + .sm\:ml-6 { + margin-left: 1.5rem; + } + + .sm\:flex { + display: flex; + } + + .sm\:hidden { + display: none; + } + + .sm\:items-center { + align-items: center; + } + + .sm\:items-stretch { + align-items: stretch; + } + + .sm\:justify-start { + justify-content: flex-start; + } + + .sm\:space-x-8 > :not([hidden]) ~ :not([hidden]) { + --tw-space-x-reverse: 0; + margin-right: calc(2rem * var(--tw-space-x-reverse)); + margin-left: calc(2rem * calc(1 - var(--tw-space-x-reverse))); + } + + .sm\:px-6 { + padding-left: 1.5rem; + padding-right: 1.5rem; + } + + .sm\:pr-0 { + padding-right: 0px; + } +} + +@media (min-width: 1024px) { + .lg\:block { + display: block; + } + + .lg\:hidden { + display: none; + } + + .lg\:px-8 { + padding-left: 2rem; + padding-right: 2rem; + } } diff --git a/crates/app/templates/base.html b/crates/app/templates/base.html index 6e7f954..3a67442 100644 --- a/crates/app/templates/base.html +++ b/crates/app/templates/base.html @@ -1,14 +1,21 @@ - + {% block title %}{{ title }}{% endblock %} + {% block head %}{% endblock %} - - {% block body %}{% endblock %} + +
+ {% block nav %} + {% include "layout/nav.html" %} + {% endblock %} + + {% block body %}{% endblock %} +
diff --git a/crates/app/templates/index.html b/crates/app/templates/index.html index c9d66bc..3881b0d 100644 --- a/crates/app/templates/index.html +++ b/crates/app/templates/index.html @@ -1,22 +1,26 @@ {% extends "base.html" %} - -{% block title %}Pharma Libre{% endblock %} - -{% block body %} -
+{% block title %}Pharma Libre{% endblock %} + +{% block body %} +
-

Pharma Libre

+
+

Dashboard

+
-
- Loading... +
+ +
+ Loading... +
diff --git a/crates/app/templates/layout/nav.html b/crates/app/templates/layout/nav.html new file mode 100644 index 0000000..872267f --- /dev/null +++ b/crates/app/templates/layout/nav.html @@ -0,0 +1,41 @@ + diff --git a/crates/app/templates/layout/nav/desktop/menu-items.html b/crates/app/templates/layout/nav/desktop/menu-items.html new file mode 100644 index 0000000..43190ea --- /dev/null +++ b/crates/app/templates/layout/nav/desktop/menu-items.html @@ -0,0 +1,22 @@ + +Dashboard +Team +Projects +Calendar diff --git a/crates/app/templates/layout/nav/desktop/notifications-button.html b/crates/app/templates/layout/nav/desktop/notifications-button.html new file mode 100644 index 0000000..f11c45e --- /dev/null +++ b/crates/app/templates/layout/nav/desktop/notifications-button.html @@ -0,0 +1,6 @@ + diff --git a/crates/app/templates/layout/nav/desktop/profile-dropdown.html b/crates/app/templates/layout/nav/desktop/profile-dropdown.html new file mode 100644 index 0000000..2347cbe --- /dev/null +++ b/crates/app/templates/layout/nav/desktop/profile-dropdown.html @@ -0,0 +1,73 @@ + + + diff --git a/crates/app/templates/layout/nav/desktop/profile.html b/crates/app/templates/layout/nav/desktop/profile.html new file mode 100644 index 0000000..3218eea --- /dev/null +++ b/crates/app/templates/layout/nav/desktop/profile.html @@ -0,0 +1,23 @@ + +
+
+ +
+ + {% include "layout/nav/desktop/profile-dropdown.html" %} +
diff --git a/crates/app/templates/layout/nav/logo.html b/crates/app/templates/layout/nav/logo.html new file mode 100644 index 0000000..b7a5c3d --- /dev/null +++ b/crates/app/templates/layout/nav/logo.html @@ -0,0 +1,4 @@ +
+ Your Company + +
\ No newline at end of file diff --git a/crates/app/templates/layout/nav/mobile/menu-button.html b/crates/app/templates/layout/nav/mobile/menu-button.html new file mode 100644 index 0000000..c59e6e4 --- /dev/null +++ b/crates/app/templates/layout/nav/mobile/menu-button.html @@ -0,0 +1,43 @@ + + diff --git a/crates/app/templates/layout/nav/mobile/menu-items.html b/crates/app/templates/layout/nav/mobile/menu-items.html new file mode 100644 index 0000000..b1e5088 --- /dev/null +++ b/crates/app/templates/layout/nav/mobile/menu-items.html @@ -0,0 +1,22 @@ + +Dashboard +Team +Projects +Calendar diff --git a/crates/app/templates/layout/nav/mobile/notifications-button.html b/crates/app/templates/layout/nav/mobile/notifications-button.html new file mode 100644 index 0000000..5525de9 --- /dev/null +++ b/crates/app/templates/layout/nav/mobile/notifications-button.html @@ -0,0 +1,6 @@ + diff --git a/crates/app/templates/layout/nav/mobile/profile-items.html b/crates/app/templates/layout/nav/mobile/profile-items.html new file mode 100644 index 0000000..0bc27c8 --- /dev/null +++ b/crates/app/templates/layout/nav/mobile/profile-items.html @@ -0,0 +1,15 @@ +Your Profile +Settings +Sign out diff --git a/crates/app/templates/layout/nav/mobile/profile.html b/crates/app/templates/layout/nav/mobile/profile.html new file mode 100644 index 0000000..03851b7 --- /dev/null +++ b/crates/app/templates/layout/nav/mobile/profile.html @@ -0,0 +1,11 @@ +
+ +
+
+
Tom Cook
+
tom@example.com
+
diff --git a/crates/app/templates/layout/nav/notifications-icon.html b/crates/app/templates/layout/nav/notifications-icon.html new file mode 100644 index 0000000..7f645d7 --- /dev/null +++ b/crates/app/templates/layout/nav/notifications-icon.html @@ -0,0 +1,16 @@ + +View notifications + \ No newline at end of file