mobile_nav.vue 3.84 KB
Newer Older
1
<template>
2
  <div>
HJ's avatar
HJ committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
    <nav
      id="nav"
      class="nav-bar container"
    >
      <div
        class="mobile-inner-nav"
        @click="scrollToTop()"
      >
        <div class="item">
          <a
            href="#"
            class="mobile-nav-button"
            @click.stop.prevent="toggleMobileSidebar()"
          >
            <i class="button-icon icon-menu" />
18
          </a>
HJ's avatar
HJ committed
19
          <router-link
20
            v-if="!hideSitename"
HJ's avatar
HJ committed
21 22 23 24 25 26
            class="site-name"
            :to="{ name: 'root' }"
            active-class="home"
          >
            {{ sitename }}
          </router-link>
27
        </div>
HJ's avatar
HJ committed
28 29 30 31 32 33 34 35 36 37 38 39
        <div class="item right">
          <a
            v-if="currentUser"
            class="mobile-nav-button"
            href="#"
            @click.stop.prevent="openMobileNotifications()"
          >
            <i class="button-icon icon-bell-alt" />
            <div
              v-if="unseenNotificationsCount"
              class="alert-dot"
            />
40 41
          </a>
        </div>
42
      </div>
43
    </nav>
HJ's avatar
HJ committed
44 45
    <div
      v-if="currentUser"
46 47
      class="mobile-notifications-drawer"
      :class="{ 'closed': !notificationsOpen }"
48 49
      @touchstart.stop="notificationsTouchStart"
      @touchmove.stop="notificationsTouchMove"
50
    >
51
      <div class="mobile-notifications-header">
HJ's avatar
HJ committed
52 53 54 55 56 57
        <span class="title">{{ $t('notifications.notifications') }}</span>
        <a
          class="mobile-nav-button"
          @click.stop.prevent="closeMobileNotifications()"
        >
          <i class="button-icon icon-cancel" />
58 59
        </a>
      </div>
HJ's avatar
HJ committed
60 61 62 63 64 65 66 67
      <div
        class="mobile-notifications"
        @scroll="onScroll"
      >
        <Notifications
          ref="notifications"
          :no-heading="true"
        />
68
      </div>
69
    </div>
HJ's avatar
HJ committed
70 71 72 73
    <SideDrawer
      ref="sideDrawer"
      :logout="logout"
    />
74
  </div>
75 76 77 78 79
</template>

<script src="./mobile_nav.js"></script>

<style lang="scss">
80 81 82
@import '../../_variables.scss';

.mobile-inner-nav {
83
  width: 100%;
84 85
  display: flex;
  align-items: center;
Tae Hoon's avatar
Tae Hoon committed
86
  justify-content: space-between;
87 88
}

89 90 91 92
.mobile-nav-button {
  display: flex;
  justify-content: center;
  width: 50px;
93
  position: relative;
94
  cursor: pointer;
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
}

.alert-dot {
  border-radius: 100%;
  height: 8px;
  width: 8px;
  position: absolute;
  left: calc(50% - 4px);
  top: calc(50% - 4px);
  margin-left: 6px;
  margin-top: -6px;
  background-color: $fallback--cRed;
  background-color: var(--badgeNotification, $fallback--cRed);
}

110 111 112 113
.mobile-notifications-drawer {
  width: 100%;
  height: 100vh;
  overflow-x: hidden;
114
  position: fixed;
115 116 117 118 119 120 121
  top: 0;
  left: 0;
  box-shadow: 1px 1px 4px rgba(0,0,0,.6);
  box-shadow: var(--panelShadow);
  transition-property: transform;
  transition-duration: 0.25s;
  transform: translateX(0);
122 123
  z-index: 1001;
  -webkit-overflow-scrolling: touch;
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152

  &.closed {
    transform: translateX(100%);
  }
}

.mobile-notifications-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1;
  width: 100%;
  height: 50px;
  line-height: 50px;
  position: absolute;
  color: var(--topBarText);
  background-color: $fallback--fg;
  background-color: var(--topBar, $fallback--fg);
  box-shadow: 0px 0px 4px rgba(0,0,0,.6);
  box-shadow: var(--topBarShadow);

  .title {
    font-size: 1.3em;
    margin-left: 0.6em;
  }
}

.mobile-notifications {
  margin-top: 50px;
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
  width: 100vw;
  height: calc(100vh - 50px);
  overflow-x: hidden;
  overflow-y: scroll;

  color: $fallback--text;
  color: var(--text, $fallback--text);
  background-color: $fallback--bg;
  background-color: var(--bg, $fallback--bg);

  .notifications {
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    .panel {
      border-radius: 0;
      margin: 0;
      box-shadow: none;
    }
    .panel:after {
      border-radius: 0;
    }
    .panel .panel-heading {
      border-radius: 0;
      box-shadow: none;
    }
  }
}
181 182

</style>