Modified account page to be mobile friendly

This commit is contained in:
2025-02-15 14:32:15 +11:00
parent 89e3df6862
commit 6bee6edd16
5 changed files with 46 additions and 16 deletions

View File

@@ -16,11 +16,11 @@ templ ChangeUsername(err string, username string) {
x-data={ "{ err: '" + err + "'}" } x-data={ "{ err: '" + err + "'}" }
> >
<div <div
class="flex" class="flex flex-col sm:flex-row"
x-data={ "{username: '" + username + "'}" } x-data={ "{username: '" + username + "'}" }
> >
<div <div
class="flex items-center relative" class="flex flex-col sm:flex-row sm:items-center relative"
> >
<label <label
for="username" for="username"
@@ -31,15 +31,15 @@ templ ChangeUsername(err string, username string) {
id="username" id="username"
name="username" name="username"
class="py-1 px-4 rounded-lg text-md class="py-1 px-4 rounded-lg text-md
bg-surface0 border border-surface2 bg-surface0 border border-surface2 w-50 sm:ml-5
disabled:opacity-50 ml-5 disabled:pointer-events-none" disabled:opacity-50 ml-0 disabled:pointer-events-none"
required required
aria-describedby="username-error" aria-describedby="username-error"
x-model="username" x-model="username"
/> />
<div <div
class="absolute inset-y-0 end-0 class="absolute inset-y-0 sm:start-66 start-43 pt-9
pointer-events-none pe-3 pt-2" pointer-events-none sm:pe-3 sm:pt-2"
x-show="err" x-show="err"
x-cloak x-cloak
> >
@@ -60,9 +60,9 @@ templ ChangeUsername(err string, username string) {
</svg> </svg>
</div> </div>
</div> </div>
<div> <div class="mt-2 sm:mt-0">
<button <button
class="rounded-lg bg-blue py-1 px-2 text-mantle ml-2 class="rounded-lg bg-blue py-1 px-2 text-mantle sm:ml-2
hover:cursor-pointer hover:bg-blue/75 transition" hover:cursor-pointer hover:bg-blue/75 transition"
x-cloak x-cloak
x-show={ "username !=='" + user.Username + "'" } x-show={ "username !=='" + user.Username + "'" }
@@ -85,7 +85,7 @@ templ ChangeUsername(err string, username string) {
</div> </div>
</div> </div>
<p <p
class="block text-red ml-24 mt-1 transition" class="block text-red sm:ml-24 mt-1 transition"
x-cloak x-cloak
x-show="err" x-show="err"
x-text="err" x-text="err"

View File

@@ -4,9 +4,11 @@ templ AccountContainer(subpage string) {
<div <div
id="account-container" id="account-container"
class="flex max-w-200 min-h-100 mx-auto bg-mantle mt-10 rounded-xl" class="flex max-w-200 min-h-100 mx-auto bg-mantle mt-10 rounded-xl"
x-data="{big:window.innerWidth >=768, open:false}"
@resize.window="big = window.innerWidth >= 768"
> >
@SelectMenu(subpage) @SelectMenu(subpage)
<div class="mt-5 w-full"> <div class="mt-5 w-full md:ml-[200px] ml-[40px] transition-all duration-300">
<div <div
class="pl-5 text-2xl text-subtext1 border-b class="pl-5 text-2xl text-subtext1 border-b
border-overlay0 w-[90%] mx-auto" border-overlay0 w-[90%] mx-auto"

View File

@@ -30,14 +30,42 @@ templ SelectMenu(activePage string) {
page := fmt.Sprintf("{page:'%s'}", activePage) page := fmt.Sprintf("{page:'%s'}", activePage)
}} }}
<form <form
class="flex bg-surface0 w-fit border-e border-overlay0
rounded-l-xl"
hx-post="/account-select-page" hx-post="/account-select-page"
hx-target="#account-container" hx-target="#account-container"
hx-swap="outerHTML" hx-swap="outerHTML"
class="relative"
> >
<div> <div
<div class="px-4 py-6"> class="bg-surface0 border-e border-overlay0 ease-in-out
absolute top-0 left-0 z-1
rounded-l-xl h-full overflow-hidden transition-all duration-300"
x-bind:style="(open || big) ? 'width: 200px;' : 'width: 40px;'"
>
<div x-show="!big">
<button
type="button"
@click="open = !open"
class="block rounded-lg p-2.5 md:hidden transition
bg-surface0 text-subtext0 hover:text-overlay2/75"
>
<span class="sr-only">Toggle menu</span>
<svg
xmlns="http://www.w3.org/2000/svg"
class="size-5"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
stroke-width="2"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M4 6h16M4 12h16M4 18h16"
></path>
</svg>
</button>
</div>
<div class="px-4 py-6" x-show="(open || big)">
<ul class="mt-6 space-y-1" x-data={ page }> <ul class="mt-6 space-y-1" x-data={ page }>
for _, item := range menuItems { for _, item := range menuItems {
{{ {{

View File

@@ -8,7 +8,7 @@ templ sideNav(navItems []NavItem) {
<div <div
x-show="open" x-show="open"
x-transition x-transition
class="absolute w-full bg-mantle sm:hidden" class="absolute w-full bg-mantle sm:hidden z-10"
> >
<div class="px-4 py-6"> <div class="px-4 py-6">
<ul class="space-y-1"> <ul class="space-y-1">

View File

@@ -55,7 +55,7 @@ templ Global() {
class="flex flex-col h-screen justify-between" class="flex flex-col h-screen justify-between"
> >
@nav.Navbar() @nav.Navbar()
<div id="page-content" class="mb-auto"> <div id="page-content" class="mb-auto px-5">
{ children... } { children... }
</div> </div>
@footer.Footer() @footer.Footer()