Refactor NavBar

This commit is contained in:
2024-12-05 13:21:17 +01:00
parent 387f3f658d
commit 0a5e6cb249
4 changed files with 36 additions and 12 deletions

View File

@@ -0,0 +1,19 @@
<script lang="ts" setup>
defineProps<{
championName?: string
championLanes?: Array<LaneData>
}>()
const emit = defineEmits<{
stateChange: [state: string, lane: number]
}>()
</script>
<template>
<NavSideBar :champion-name="championName"
:champion-lanes="championLanes"
@state-change="(s, l) => emit('stateChange', s, l)"/>
<NavBottomBar :champion-name="championName"
:champion-lanes="championLanes"
@state-change="(s, l) => emit('stateChange', s, l)"/>
</template>

View File

@@ -2,7 +2,7 @@
import { LANE_IMAGES, lanePositionToIndex, POSITIONS_STR } from '~/utils/cdragon';
defineProps<{
championName: string
championName?: string
championLanes?: Array<LaneData>
}>()
const emit = defineEmits<{

View File

@@ -20,6 +20,9 @@ function handleStateChange(newState : string, newLane: number) {
</script>
<template>
<!-- To make content have a 300px margin -->
<div class="sidebar-margin" />
<div class="sidebar-container">
<Logo font-size="2.6rem" img-width="60" style="padding-left: 15px; padding-right: 15px; margin-top: 30px;"/>
@@ -49,13 +52,16 @@ function handleStateChange(newState : string, newLane: number) {
.sidebar-container {
background-color: #2B2826;
width: 300px;
/* height: 100%; */
flex-shrink: 0;
margin: 0px;
/* position: absolute;
top: 0px;
left: 0px; */
position: fixed;
top: 0;
left: 0;
height: 100%;
z-index: 10;
}
.sidebar-margin {
width: 300px;
flex-shrink: 0;
}
.sidebar-link {
user-select: none;
@@ -77,5 +83,8 @@ function handleStateChange(newState : string, newLane: number) {
.sidebar-container {
display: none;
}
.sidebar-margin {
display: none;
}
}
</style>

View File

@@ -28,13 +28,9 @@ function updateState(newState : string, newLane : number) {
<Title>{{ championData.name }}</Title>
</Head>
<NavBottomBar :champion-name="championData.name"
:champion-lanes="championData.lanes"
@state-change="updateState"/>
<div id="alias-content-wrapper">
<NavSideBar :champion-name="championData.name"
<NavBar :champion-name="championData.name"
:champion-lanes="championData.lanes"
@state-change="updateState"/>