KitList.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <b-overlay :show="filteredNodes === undefined" class="kit-list" z-index="0">
  3. <div class="kit-list-wrapper">
  4. <header class="kit-list-header">
  5. <div class="kit-list-header-intro" v-html="intro" />
  6. <search-input v-model="search" class="input-search" />
  7. </header>
  8. <div class="kit-list-container nodes-grid">
  9. <node-view
  10. v-for="node in filteredNodes" :key="'kit-' + node.id"
  11. :node="node"
  12. mode="card"
  13. @click.native.capture="$emit('open-node', node.id)"
  14. />
  15. </div>
  16. </div>
  17. </b-overlay>
  18. </template>
  19. <script>
  20. import { mapGetters } from 'vuex'
  21. import { NodeView } from '@/components/nodes'
  22. import { SearchInput } from '@/components/formItems'
  23. import { searchInNode } from '@/store/utils'
  24. export default {
  25. name: 'KitList',
  26. components: {
  27. NodeView,
  28. SearchInput
  29. },
  30. props: {
  31. },
  32. data () {
  33. return {
  34. search: '',
  35. intro: ''
  36. }
  37. },
  38. computed: {
  39. ...mapGetters(['sheets']),
  40. filteredNodes () {
  41. if (!this.sheets) return
  42. const search = this.search.toLowerCase()
  43. return this.sheets.filter(node => searchInNode(search, node))
  44. }
  45. },
  46. async created () {
  47. this.$store.dispatch('QUERY_PAGE', 'kit').then(page => {
  48. this.intro = page.content
  49. })
  50. }
  51. }
  52. </script>
  53. <style lang="scss" scoped>
  54. .kit-list {
  55. overflow-y: auto;
  56. height: 100%;
  57. &-wrapper {
  58. padding: 1.15rem;
  59. @include media-breakpoint-up($size-bp) {
  60. padding: 2.15rem;
  61. }
  62. }
  63. &-header {
  64. margin-bottom: 1.15rem;
  65. @include media-breakpoint-up($size-bp) {
  66. display: flex;
  67. justify-content: space-between;
  68. margin-bottom: 2.15rem;
  69. }
  70. .input-search {
  71. min-width: 30%;
  72. margin-bottom: 2.15rem;
  73. margin-top: 1.15rem;
  74. @include media-breakpoint-up($size-bp) {
  75. margin: 0;
  76. margin-left: 1.15rem;
  77. }
  78. }
  79. }
  80. .node-view {
  81. cursor: pointer;
  82. }
  83. }
  84. </style>