UsersList.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. .night-mode {
  35. .sidebar {
  36. background-color: $night-mode-secondary;
  37. .title {
  38. color: #fff;
  39. }
  40. * {
  41. color: #ddd;
  42. }
  43. }
  44. }
  45. .sidebar {
  46. position: fixed;
  47. z-index: 1;
  48. top: 0;
  49. right: 0;
  50. width: 300px;
  51. height: 100vh;
  52. background-color: $white;
  53. box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16),
  54. 0 2px 10px 0 rgba(0, 0, 0, 0.12);
  55. }
  56. .inner-wrapper {
  57. top: 60px;
  58. position: relative;
  59. }
  60. .slide-transition {
  61. transition: transform 0.6s ease-in-out;
  62. transform: translateX(0);
  63. }
  64. .slide-enter,
  65. .slide-leave {
  66. transform: translateX(100%);
  67. }
  68. .title {
  69. background-color: rgb(3, 169, 244);
  70. text-align: center;
  71. padding: 10px;
  72. color: $white;
  73. font-weight: 600;
  74. }
  75. .menu {
  76. padding: 0 20px;
  77. }
  78. .menu-list li a:hover {
  79. color: #000 !important;
  80. }
  81. </style>