optimize for mobile

This commit is contained in:
LouisLam
2021-07-11 15:23:28 +08:00
parent ae07cd9c35
commit f9800a087e
5 changed files with 109 additions and 22 deletions

View File

@@ -6,18 +6,25 @@
</div>
</div>
<header class="d-flex flex-wrap justify-content-center py-3 mb-3 border-bottom">
<!-- Desktop header -->
<header class="d-flex flex-wrap justify-content-center py-3 mb-3 border-bottom" v-if="! $root.isMobile">
<router-link to="/dashboard" class="d-flex align-items-center mb-3 mb-md-0 me-md-auto text-dark text-decoration-none">
<object class="bi me-2 ms-4" width="40" data="/icon.svg"></object>
<span class="fs-4 title">Uptime Kuma</span>
</router-link>
<ul class="nav nav-pills">
<ul class="nav nav-pills" >
<li class="nav-item"><router-link to="/dashboard" class="nav-link">📊 Dashboard</router-link></li>
<li class="nav-item"><router-link to="/settings" class="nav-link"> Settings</router-link></li>
<li class="nav-item"><router-link to="/settings" class="nav-link">🔧 Settings</router-link></li>
</ul>
</header>
<!-- Mobile header -->
<header class="d-flex flex-wrap justify-content-center mt-3 mb-3" v-else>
<router-link to="/dashboard" class="d-flex align-items-center text-dark text-decoration-none">
<object class="bi" width="40" data="/icon.svg"></object>
<span class="fs-4 title ms-2">Uptime Kuma</span>
</router-link>
</header>
<main>
@@ -26,6 +33,14 @@
<Login v-if="! $root.loggedIn && $root.allowLoginDialog" />
</main>
<!-- Mobile Only -->
<div style="width: 100%;height: 60px;" v-if="$root.isMobile"></div>
<nav class="bottom-nav" v-if="$root.isMobile">
<router-link to="/dashboard" class="nav-link" @click="$root.cancelActiveList"><div>📊</div>Dashboard</router-link>
<a href="#" :class=" { 'router-link-exact-active' : $root.showListMobile } " @click="$root.showListMobile = ! $root.showListMobile"><div>📃</div>List</a>
<router-link to="/add" class="nav-link" @click="$root.cancelActiveList"><div></div>Add</router-link>
<router-link to="/settings" class="nav-link" @click="$root.cancelActiveList"><div>🔧</div>Settings</router-link>
</nav>
</template>
<script>
@@ -34,6 +49,14 @@ import Login from "../components/Login.vue";
export default {
components: {
Login
},
data() {
return {
}
},
computed: {
},
mounted() {
this.init();
@@ -48,27 +71,65 @@ export default {
if (this.$route.name === "root") {
this.$router.push("/dashboard")
}
}
},
}
}
</script>
<style scoped>
.title {
font-weight: bold;
}
<style scoped lang="scss">
@import "../assets/vars.scss";
.nav {
margin-right: 25px;
}
.bottom-nav {
z-index: 1000;
position: fixed;
bottom: 0;
height: 60px;
width: 100%;
left: 0;
background-color: #fff;
box-shadow: 0 15px 47px 0 rgba(0, 0, 0, 0.05), 0 5px 14px 0 rgba(0, 0, 0, 0.05);
text-align: center;
white-space: nowrap;
padding: 0 35px;
.lost-connection {
padding: 5px;
background-color: crimson;
color: white;
}
a {
text-align: center;
width: 25%;
display: inline-block;
height: 100%;
padding: 8px 10px 0;
font-size: 13px;
color: #c1c1c1;
overflow: hidden;
text-decoration: none;
main {
margin-bottom: 30px;
&.router-link-exact-active {
color: $primary;
font-weight: bold;
}
div {
font-size: 20px;
}
}
}
.title {
font-weight: bold;
}
.nav {
margin-right: 25px;
}
.lost-connection {
padding: 5px;
background-color: crimson;
color: white;
}
main {
margin-bottom: 30px;
}
</style>