Index.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <div class='route_container'>
  3. <div class='h1'>Categories</div>
  4. <div class='index_categories'>
  5. <div
  6. class='index_category'
  7. @click='$router.push("/category/" + category.value.toLowerCase())'
  8. v-for='category in $store.state.meta.categories'
  9. >
  10. <div class='index_category__name'>{{category.name}}</div>
  11. <div>
  12. <div class='index_category__latest_post'>Latest post here</div>
  13. <div class='index_category__latest_post_date'>19:53</div>
  14. </div>
  15. </div>
  16. </div>
  17. <div v-if='!$store.state.meta.categories.length'>
  18. There are no categories to show, but you can add them on the admin page
  19. </div>
  20. </div>
  21. </template>
  22. <script>
  23. import addFlexBoxChildren from '../../assets/js/flexBoxGridCorrect'
  24. export default {
  25. name: 'index',
  26. components: {},
  27. computed: {},
  28. methods: {},
  29. mounted () {
  30. addFlexBoxChildren('.index_categories', 'index_category');
  31. }
  32. }
  33. </script>
  34. <style lang='scss' scoped>
  35. @import '../../assets/scss/variables.scss';
  36. .index_categories {
  37. display: flex;
  38. overflow-y: auto;
  39. max-height: 100%;
  40. flex-wrap: wrap;
  41. justify-content: space-between;
  42. padding: 0.5rem 0px;
  43. }
  44. .index_category {
  45. background-color: rgba(76, 175, 80, 0.86);
  46. width: calc(100% / 4 - 1rem);
  47. height: 5rem;
  48. margin: 0.5rem;
  49. padding: 0.5rem;
  50. cursor: pointer;
  51. color: #fff;
  52. transition: filter 0.2s, transform 0.2s;
  53. &:hover {
  54. filter: brightness(0.8) contrast(130%);
  55. }
  56. &:active {
  57. transform: scale(0.96);
  58. }
  59. @at-root #{&}__name {
  60. @include text($font--role-default, 1.5rem);
  61. }
  62. @at-root #{&}__latest_post {
  63. @include text($font--role-default, 1rem);
  64. }
  65. @at-root #{&}__latest_post_date {
  66. color: $color__gray--darker;
  67. @include text($font--role-default, 1rem);
  68. }
  69. }
  70. </style>