feat(layout): #211 update for more "app" like feel
All checks were successful
Build Docker Image / Build-Docker-Image (push) Successful in 4m49s
All checks were successful
Build Docker Image / Build-Docker-Image (push) Successful in 4m49s
This commit is contained in:
@@ -1,10 +1,12 @@
|
|||||||
package template
|
package template
|
||||||
|
|
||||||
func layoutLinkClass(isActive bool) string {
|
func layoutLinkClass(isActive bool) string {
|
||||||
|
common := "text-2xl p-2 text-gray-900 decoration-yellow-400 decoration-[0.25rem] hover:bg-gray-200 rounded-lg"
|
||||||
if isActive {
|
if isActive {
|
||||||
return "text-xl hover:bg-gray-100 p-1 duration-100 rounded-xl transition-colors text-gray-900"
|
return common + " " + "underline"
|
||||||
}
|
}
|
||||||
return "text-xl hover:bg-gray-100 hover:text-gray-900 p-1 duration-200 rounded-xl transition-colors text-gray-400"
|
|
||||||
|
return common + " " + "hover:underline"
|
||||||
}
|
}
|
||||||
|
|
||||||
templ Layout(slot templ.Component, user templ.Component, loggedIn bool, path string) {
|
templ Layout(slot templ.Component, user templ.Component, loggedIn bool, path string) {
|
||||||
@@ -22,7 +24,7 @@ templ Layout(slot templ.Component, user templ.Component, loggedIn bool, path str
|
|||||||
"includeIndicatorStyles": false,
|
"includeIndicatorStyles": false,
|
||||||
"selfRequestsOnly": true,
|
"selfRequestsOnly": true,
|
||||||
"allowScriptTags": false
|
"allowScriptTags": false
|
||||||
}'
|
}'
|
||||||
/>
|
/>
|
||||||
<script src="/static/js/htmx.min.js"></script>
|
<script src="/static/js/htmx.min.js"></script>
|
||||||
<script src="/static/js/toast.js"></script>
|
<script src="/static/js/toast.js"></script>
|
||||||
@@ -30,39 +32,40 @@ templ Layout(slot templ.Component, user templ.Component, loggedIn bool, path str
|
|||||||
<script src="/static/js/echarts.min.js"></script>
|
<script src="/static/js/echarts.min.js"></script>
|
||||||
<script src="/static/js/dashboard.js" defer></script>
|
<script src="/static/js/dashboard.js" defer></script>
|
||||||
</head>
|
</head>
|
||||||
<body class="h-screen flex flex-col" hx-headers='{"Csrf-Token": "CSRF_TOKEN"}'>
|
<body class="flex flex-col min-h-screen" hx-headers='{"Csrf-Token": "CSRF_TOKEN"}'>
|
||||||
// Header
|
<header class="sticky top-0 z-50 bg-white flex items-center gap-2 p-4 border-b-1 border-gray-200">
|
||||||
<nav class="flex bg-white items-center gap-2 py-1 px-2 h-12 md:gap-10 md:px-10 md:py-2">
|
|
||||||
<a href="/" class="flex gap-2 mr-20">
|
<a href="/" class="flex gap-2 mr-20">
|
||||||
<img class="w-6" src="/static/favicon.svg" alt="SpendSparrow logo"/>
|
<img class="w-6" src="/static/favicon.svg" alt="SpendSparrow logo"/>
|
||||||
<span class="text-4xl font-bold font-pirata">SpendSparrow</span>
|
<span class="text-4xl font-bold font-pirata">SpendSparrow</span>
|
||||||
</a>
|
</a>
|
||||||
if loggedIn {
|
|
||||||
<a class={ layoutLinkClass(path == "/dashboard") } href="/dashboard">Dashboard</a>
|
|
||||||
<a class={ layoutLinkClass(path == "/transaction") } href="/transaction">Transaction</a>
|
|
||||||
<a class={ layoutLinkClass(path == "/treasurechest") } href="/treasurechest">Treasure Chest</a>
|
|
||||||
<a class={ layoutLinkClass(path == "/account") } href="/account">Account</a>
|
|
||||||
}
|
|
||||||
<div class="ml-auto">
|
<div class="ml-auto">
|
||||||
@user
|
@user
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</header>
|
||||||
<div class="h-12 fixed top-12 mr-4 inset-0 bg-linear-0 from-transparent to-white"></div>
|
|
||||||
// Content
|
// Content
|
||||||
<main class="flex-1 overflow-auto">
|
<div class="flex flex-1">
|
||||||
if slot != nil {
|
if loggedIn {
|
||||||
@slot
|
<aside class="w-64 h-[calc(100vh-4rem)] sticky top-18 border-r-1 border-gray-200 overflow-y-auto p-4">
|
||||||
|
<nav class="flex gap-2 flex-col text-lg mt-5 px-5 pt-2">
|
||||||
|
<a class={ layoutLinkClass(path == "/dashboard") } href="/dashboard">Dashboard</a>
|
||||||
|
<a class={ layoutLinkClass(path == "/transaction") } href="/transaction">Transaction</a>
|
||||||
|
<a class={ layoutLinkClass(path == "/treasurechest") } href="/treasurechest">Treasure Chest</a>
|
||||||
|
<a class={ layoutLinkClass(path == "/account") } href="/account">Account</a>
|
||||||
|
</nav>
|
||||||
|
</aside>
|
||||||
}
|
}
|
||||||
</main>
|
<main class="flex-1 p-6">
|
||||||
// Footer
|
if slot != nil {
|
||||||
<!-- </div> -->
|
@slot
|
||||||
|
}
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
<div id="toasts" class="fixed bottom-4 right-4 ml-4 max-w-96 flex flex-col gap-2 z-50">
|
<div id="toasts" class="fixed bottom-4 right-4 ml-4 max-w-96 flex flex-col gap-2 z-50">
|
||||||
<div
|
<div
|
||||||
id="toast"
|
id="toast"
|
||||||
class="transition-all duration-300 opacity-0 px-4 py-2 text-lg hidden text-bold rounded bg-amber-900 text-white"
|
class="transition-all duration-300
|
||||||
>
|
opacity-0 px-4 py-2 text-lg hidden text-bold rounded bg-amber-900 text-white"
|
||||||
M
|
></div>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user