Rework menu UX

This commit is contained in:
Laurent
2024-10-28 16:29:27 +01:00
parent 74123093bb
commit 8be7b82db6
4 changed files with 57 additions and 48 deletions

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M438.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L338.8 224 32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l306.7 0L233.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160z"/></svg>

After

Width:  |  Height:  |  Size: 452 B

View File

@@ -5,52 +5,54 @@
import dice from '$lib/assets/dice.svg';
import about from '$lib/assets/about.svg';
import logo from '$lib/assets/logo2.png'
import arrow from '$lib/assets/arrow.svg'
import {onMount} from "svelte";
import SplashScreen from "$lib/components/SplashScreen.svelte";
onMount(async () => {
/*window.$(".menu-collapsed").click(function () {
window.$(this).toggleClass("menu-expanded");
});*/
window.$(".expander").click(function () {
window.$(".menu").toggleClass("menu-collapsed menu-expanded");
});
});
</script>
<SplashScreen/>-
<SplashScreen/>
<div class="menu">
<div class="menu menu-collapsed">
<div class="burger"></div>
<nav>
<a href="/">
<img src={leaderboard}
<a class="expander">
<img class="item-hint" src={arrow}
height="30"
width="30"
alt="leaderboard"
>
<div>Leaderboard</div>
alt="arrow">
</a>
<a href="/play">
<img src={dice}
<a href="/" class="menu-item">
<img class="item-hint" src={leaderboard}
height="30"
width="30"
alt="dice"
>
<div>Play</div>
alt="leaderboard">
<div class="item-title">Leaderboard</div>
</a>
<a href="/about">
<img src={about}
<a href="/play" class="menu-item">
<img class="item-hint" src={dice}
height="30"
width="30"
alt="dice">
<div class="item-title">Play</div>
</a>
<a href="/about" class="menu-item">
<img class="item-hint" src={about}
height="30"
width="30"
alt="about"
>
<div>About</div>
<div class="item-title">About</div>
</a>
</nav>
</div>

View File

@@ -11,8 +11,6 @@
</script>
<h1>Phrase d'accroche</h1>
<LeaderBoard bind:scores={$scoreStore}></LeaderBoard>

View File

@@ -1,5 +1,4 @@
.menu {
font-family: 'Roboto', sans-serif;
.menu-collapsed, .menu-expanded {
position: fixed;
top: 0;
left: 0;
@@ -13,51 +12,60 @@
transition: width .3s;
}
.menu:hover {
width: 300px;
.menu-collapsed .menu-item{
display: none;
}
.menu nav {
.menu-expanded, .menu-collapsed {
display: flex;
flex-direction: column;
justify-content: center;
align-items: start;
}
.menu nav a {
.menu-expanded {
width: 300px;
}
.expander, .menu-item {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
margin: 15px 30px 0 5px;
border-radius: 5px;
height: fit-content;
width: 250px;
}
.menu nav a {
font-size: .9rem;
.expander, .menu-item {
text-decoration: none;
margin: 15px 5px 5px 5px;
padding: 5px;
}
.menu nav a div {
.item-title {
margin-left: 5%;
color: #4b0611;
}
.menu nav a:hover,
.menu nav:first-child a {
.menu-item:hover {
background: #dd3328;
}
.menu-item .item-hint:hover {
transition: 0.3s;
transform: rotate(360deg);
}
.menu-expanded .expander .item-hint {
transform: rotate(180deg);
}
@media screen and (max-width: 600px) {
.menu
{
.menu-collapsed {
width: 45px
}
.menu a img {
.item-hint {
width: 20px;
height: 20px;
}