partey_workadventure/front/src/Components/Menu/Menu.svelte

80 lines
2.2 KiB
Svelte
Raw Normal View History

2021-07-12 17:39:16 +02:00
<script lang="typescript">
import GameQualityMenu from "./GameQualityMenu.svelte";
import EditProfileMenu from "./EditProfileMenu.svelte";
enum SubMenus {
2021-07-13 12:00:09 +02:00
settings = 1,
2021-07-12 17:39:16 +02:00
editProfile,
shareUrl,
}
let activeSubMenu: SubMenus = 2;
function switchMenu(menu: SubMenus) {
activeSubMenu = menu;
}
2021-07-13 12:00:09 +02:00
function gotToCreateMapPage() {
//const sparkHost = 'https://'+window.location.host.replace('play.', '')+'/choose-map.html';
//TODO fix me: this button can to send us on WorkAdventure BO.
const sparkHost = "https://workadventu.re/getting-started";
window.open(sparkHost, "_blank");
}
2021-07-12 17:39:16 +02:00
</script>
<aside class="menuContainer">
<section class="menuNav">
<nav>
<ul>
2021-07-13 12:00:09 +02:00
<li class:active={activeSubMenu === SubMenus.settings } on:click={() => switchMenu(SubMenus.settings)}>Settings</li>
<li class:active={activeSubMenu === SubMenus.shareUrl } on:click={() => switchMenu(SubMenus.shareUrl)}>Share Url</li>
<li class:active={activeSubMenu === SubMenus.editProfile } on:click={() => switchMenu(SubMenus.editProfile)}>Edit Profile</li>
<li on:click={() => gotToCreateMapPage()}>Create Map</li>
<li>Go to Menu</li>
2021-07-12 17:39:16 +02:00
</ul>
</nav>
</section>
<section class="subMenuContainer">
2021-07-13 12:00:09 +02:00
{#if activeSubMenu === SubMenus.settings}
2021-07-12 17:39:16 +02:00
<GameQualityMenu></GameQualityMenu>
{:else if activeSubMenu === SubMenus.editProfile}
<EditProfileMenu></EditProfileMenu>
{/if}
</section>
</aside>
<style lang="scss">
aside.menuContainer{
pointer-events: auto;
background: #7a7a7a;
position: absolute;
width: 30vw;
height: 70vh;
border-radius: 8px;
display: flex;
padding:5px;
color: white;
}
section.menuNav{
width:30%;
border-right:white solid 4px;
nav{
ul{
padding: 10px;
list-style: none;
li{
cursor: pointer;
}
li.active{
background: #6f6f6f ;
}
}
}
}
</style>