Skip to content

Commit

Permalink
Merge pull request #5 from mbaraa/feat/mobile-nav
Browse files Browse the repository at this point in the history
Feat: Mobile navigator
  • Loading branch information
mbaraa authored May 6, 2024
2 parents 90028b1 + 3a9265a commit 9398a1c
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 1 deletion.
5 changes: 5 additions & 0 deletions static/images/nav-about-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions static/images/nav-about-selected-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions static/images/nav-home-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions static/images/nav-home-selected-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions static/images/nav-playlists-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions static/images/nav-playlists-selected-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions static/images/nav-profile-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions static/images/nav-profile-selected-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions views/components/mobilenav/mobilenav.templ
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package mobilenav

templ MobileNav() {
<div
class={ "fixed", "bottom-0", "left-0", "h-auto", "w-full" }
>
<nav
class={ "bg-primary", "h-[70px]", "m-[5px]", "rounded-[10px]", "flex", "justify-center", "items-center" }
>
<ul class={ "w-full", "m-0", "p-5", "list-none", "flex", "justify-between" }>
<li>
<a href="/"><img src="/static/images/nav-home-icon.svg" alt="Home"/></a>
</li>
<li>
<a href="/playlists"><img src="/static/images/nav-playlists-icon.svg" alt="Playlists"/></a>
</li>
<li>
<a href="/profile"><img src="/static/images/nav-profile-icon.svg" alt="Profile"/></a>
</li>
<li>
<a href="/about"><img src="/static/images/nav-about-icon.svg" alt="About"/></a>
</li>
</ul>
</nav>
</div>
<div class="hidden">
<img src="/static/images/nav-home-selected-icon.svg" alt="Home"/>
<img src="/static/images/nav-playlists-selected-icon.svg" alt="Playlists"/>
<img src="/static/images/nav-profile-selected-icon.svg" alt="Profile"/>
<img src="/static/images/nav-about-selected-icon.svg" alt="About"/>
</div>
}
2 changes: 1 addition & 1 deletion views/components/player/mobile_player.templ
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package player
templ mobilePlayer() {
<div
class={
"absolute", "bottom-0", "w-screen", "h-[120px]", "bg-accent", "rounded-t-3xl",
"absolute", "bottom-[80px]", "w-screen", "h-[120px]", "bg-accent", "rounded-[30px]",
"font-Ubuntu", "flex", "items-center", "justify-between", "gap-x-1", "p-[10px]",
"text-white",
}
Expand Down
10 changes: 10 additions & 0 deletions views/layouts/default.templ
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"dankmuzikk/views/components/player"
"dankmuzikk/views/components/loading"
"fmt"
"dankmuzikk/views/components/mobilenav"
)

templ Default(isMobile bool, themeName string, children ...templ.Component) {
Expand Down Expand Up @@ -63,10 +64,19 @@ templ Default(isMobile bool, themeName string, children ...templ.Component) {
for _, child := range children {
@child
}
<!--
For when opened on a desktop and the client's width is really small,
and a similar thing isn't being done for mobile, since mobile clients can't change width w/o reloading.
And since desktops don't really mind rendering the same shit twice.
-->
<div style="display: contents" class={ "md:hidden" }>
@mobilenav.MobileNav()
</div>
<div id="loading" class="hidden">
@loading.Loading()
</div>
@player.PlayerSticky(isMobile)
//
<script src="/static/js/utils.js"></script>
<script type="module">
function registerServiceWorkers() {
Expand Down

0 comments on commit 9398a1c

Please sign in to comment.