|
@@ -0,0 +1,134 @@
|
|
|
+<template>
|
|
|
+ <nb-container>
|
|
|
+ <nb-content class="sidebar-content-wrapper" :bounces="false">
|
|
|
+ <image
|
|
|
+ :source="drawerCover"
|
|
|
+ class="drawer-cover"
|
|
|
+ :style="stylesObj.drawerCoverObj"
|
|
|
+ />
|
|
|
+
|
|
|
+ <nb-list>
|
|
|
+ <nb-list-item
|
|
|
+ v-for="data in datas"
|
|
|
+ :key="data.route"
|
|
|
+ button
|
|
|
+ noBorder
|
|
|
+ :onPress="() => handleListItemClick(data)"
|
|
|
+ >
|
|
|
+ <nb-left>
|
|
|
+ <nb-icon
|
|
|
+ active
|
|
|
+ :name="data.icon"
|
|
|
+ :style="{ color: '#777', fontSize: 26, width: 30 }"
|
|
|
+ />
|
|
|
+
|
|
|
+ <nb-text>
|
|
|
+ {{ data.name }}
|
|
|
+ </nb-text>
|
|
|
+ </nb-left>
|
|
|
+
|
|
|
+ <nb-right v-if="data.types" :style="{ flex: 1 }">
|
|
|
+ <nb-badge
|
|
|
+ class="list-item-badge-container"
|
|
|
+ :style="{ backgroundColor: data.bg }"
|
|
|
+ >
|
|
|
+ <nb-text
|
|
|
+ class="list-item-badge-text"
|
|
|
+ :style="stylesObj.badgeText"
|
|
|
+ >
|
|
|
+ {{ `${data.types} Types` }}
|
|
|
+ </nb-text>
|
|
|
+ </nb-badge>
|
|
|
+ </nb-right>
|
|
|
+ </nb-list-item>
|
|
|
+ </nb-list>
|
|
|
+ </nb-content>
|
|
|
+ </nb-container>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import { Dimensions, Platform } from "react-native";
|
|
|
+ import drawerCover from "../../assets/drawer-cover.png";
|
|
|
+
|
|
|
+ const deviceHeight = Dimensions.get("window").height;
|
|
|
+ const deviceWidth = Dimensions.get("window").width;
|
|
|
+
|
|
|
+ export default {
|
|
|
+ name: 'SideBar',
|
|
|
+ props: {
|
|
|
+ navigation: {
|
|
|
+ type: Object
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ drawerCover,
|
|
|
+ stylesObj: {
|
|
|
+ drawerCoverObj: {
|
|
|
+ height: deviceHeight / 3.5
|
|
|
+ },
|
|
|
+ badgeText: {
|
|
|
+ fontSize: Platform.OS === "android" ? 11 : 13,
|
|
|
+ marginTop: Platform.OS === "android" ? -3 : 0,
|
|
|
+ fontWeight: "700"
|
|
|
+ }
|
|
|
+ },
|
|
|
+ datas: [
|
|
|
+ {
|
|
|
+ name: "Расписание",
|
|
|
+ route: "Lessons",
|
|
|
+ icon: "school",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "Звонки",
|
|
|
+ route: "Calls",
|
|
|
+ icon: "notifications",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "Домашка",
|
|
|
+ route: "Homework",
|
|
|
+ icon: "home",
|
|
|
+ bg: "#477EEA",
|
|
|
+ types: "100500"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: "Настройки",
|
|
|
+ route: "Settings",
|
|
|
+ icon: "settings",
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ handleListItemClick(dataObj) {
|
|
|
+ this.navigation.navigate(dataObj.route);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+</script>
|
|
|
+
|
|
|
+<style>
|
|
|
+ .sidebar-content-wrapper {
|
|
|
+ flex: 1;
|
|
|
+ background-color: #fff;
|
|
|
+ }
|
|
|
+
|
|
|
+ .drawer-cover {
|
|
|
+ flex: 1;
|
|
|
+ align-self: stretch;
|
|
|
+ position: relative;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .list-item-badge-container {
|
|
|
+ border-radius: 3px;
|
|
|
+ height: 25px;
|
|
|
+ width: 75px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .list-item-badge-text {
|
|
|
+ font-weight: 700;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 30px;
|
|
|
+ }
|
|
|
+</style>
|