doc: update navigation component

This commit is contained in:
Leon Xu
2022-02-18 18:20:42 -08:00
parent 919b799672
commit d8a7fa68df
+86 -4
View File
@@ -1,8 +1,90 @@
<template></template>
<template>
<div>
<header v-if="addCityActive" class="container add-city">
<nav>
<span>Add City</span>
<div class="right">
<i @click="editCities" ref="editCities" class="far fa-edit"></i>
<i @click="reloadApp" class="fas fa-sync"></i>
<i @click="addCity" class="fas fa-plus"></i>
</div>
</nav>
</header>
<header v-else class="container" :class="{ day: isDay, night: isNight }">
<nav>
<router-link class="router-link" :to="{ name: 'AddCity' }">
<i class="fas fa-plus"></i>
</router-link>
<span
>{{ new Date().toLocaleString("en-us", { weekday: "short" }) }},
{{ new Date().toLocaleString("en-us", { month: "short" }) }}
{{ new Date().toLocaleString("en-us", { day: "2-digit" }) }}</span
>
<span>&deg; F</span>
</nav>
</header>
</div>
</template>
<script>
export default {};
export default {
name: "TheNavigation",
props: ["addCityActive", "isDay", "isNight"],
methods: {
addCity() {
this.$emit("add-city");
},
reloadApp() {
location.reload();
},
editCities() {
this.$refs.editCities.classList.toggle("edit-active");
this.$emit("edit-city");
},
},
};
</script>
<style>
</style>
<style lang="scss" scoped>
.add-city {
background-color: #313640;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
header {
z-index: 99;
position: fixed;
max-width: 1024px;
width: 100%;
nav {
display: flex;
color: #fff;
padding: 30px 0;
justify-content: space-between;
}
.edit-active {
color: rgba(210, 75, 75, 1);
}
.router-link {
color: #fff;
}
.right {
i {
font-size: 20px;
}
i:nth-child(2),
i:nth-child(3) {
margin-left: 16px;
}
}
span {
font-weight: 600;
}
}
</style>