NodeViewChildList.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <nav class="node-view-child-list" :class="{ 'smartphone': smartphone }">
  3. <ul>
  4. <li
  5. v-for="child in children" :key="child.id"
  6. class="node-view-child-list-item"
  7. >
  8. <dot-button
  9. @click="onOpen(child.id)"
  10. :variant="child.variant"
  11. :active="activeNodes.includes(child.id)"
  12. dot-only
  13. >
  14. {{ $t('variants.' + child.variant) }}
  15. </dot-button>
  16. </li>
  17. </ul>
  18. </nav>
  19. </template>
  20. <script>
  21. import { mapGetters } from 'vuex'
  22. export default {
  23. name: 'NodeViewChildList',
  24. props: {
  25. children: { type: Array, required: true },
  26. smartphone: { type: Boolean, default: false }
  27. },
  28. data () {
  29. return {
  30. }
  31. },
  32. computed: {
  33. ...mapGetters(['activeNodes'])
  34. },
  35. methods: {
  36. onOpen (childId) {
  37. this.$emit('open-child', { childId })
  38. }
  39. },
  40. mounted () {
  41. }
  42. }
  43. </script>
  44. <style lang="scss" scoped>
  45. .node-view-child-list {
  46. ul {
  47. display: flex;
  48. align-items: center;
  49. justify-content: center;
  50. height: 26px;
  51. padding: 0;
  52. margin: 0;
  53. list-style: none;
  54. }
  55. &-item {
  56. margin-right: 20px;
  57. line-height: 0;
  58. }
  59. &.smartphone {
  60. padding: $node-view-spacer-sm-y $node-view-spacer-sm-x;
  61. background-color: $white;
  62. position: sticky;
  63. top: 0;
  64. z-index: 1;
  65. ul {
  66. justify-content: space-between;
  67. }
  68. @include media-breakpoint-up(md) {
  69. display: none;
  70. }
  71. }
  72. }
  73. </style>