UsersList.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <div class="sidebar" transition="slide">
  3. <div class="inner-wrapper">
  4. <div class="title">
  5. Users
  6. </div>
  7. <h5 class="center">Total users: {{ userCount }}</h5>
  8. <aside class="menu">
  9. <ul class="menu-list">
  10. <li v-for="(username, index) in users" :key="index">
  11. <router-link
  12. :to="{ name: 'profile', params: { username } }"
  13. target="_blank"
  14. >
  15. {{ username }}
  16. </router-link>
  17. </li>
  18. </ul>
  19. </aside>
  20. </div>
  21. </div>
  22. </template>
  23. <script>
  24. import { mapState } from "vuex";
  25. export default {
  26. computed: mapState({
  27. users: state => state.station.users,
  28. userCount: state => state.station.userCount
  29. })
  30. };
  31. </script>
  32. <style lang="scss" scoped>
  33. @import "styles/global.scss";
  34. .sidebar {
  35. position: fixed;
  36. z-index: 1;
  37. top: 0;
  38. right: 0;
  39. width: 300px;
  40. height: 100vh;
  41. background-color: $white;
  42. box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16),
  43. 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  44. }
  45. .inner-wrapper {
  46. top: 60px;
  47. position: relative;
  48. }
  49. .slide-transition {
  50. transition: transform 0.6s ease-in-out;
  51. transform: translateX(0);
  52. }
  53. .slide-enter,
  54. .slide-leave {
  55. transform: translateX(100%);
  56. }
  57. .title {
  58. background-color: rgb(3, 169, 244);
  59. text-align: center;
  60. padding: 10px;
  61. color: $white;
  62. font-weight: 600;
  63. }
  64. .menu {
  65. padding: 0 20px;
  66. }
  67. .menu-list li a:hover {
  68. color: #000 !important;
  69. }
  70. </style>