NodeViewChildListGroup.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <nav class="node-view-child-list-group">
  3. <b-collapse :id="'collapse-child-list-' + id" v-model="visible">
  4. <b-list-group>
  5. <b-list-group-item
  6. v-for="child in children" :key="child.id"
  7. :variant="child.variant"
  8. href="javascript:;"
  9. @click="$parent.$emit('open-child', { childId: child.id })"
  10. >
  11. {{ $t('variants.' + child.variant) }}
  12. </b-list-group-item>
  13. </b-list-group>
  14. </b-collapse>
  15. <b-button
  16. class="btn-children"
  17. :class="visible ? null : 'collapsed'"
  18. :aria-expanded="visible ? 'true' : 'false'"
  19. :aria-controls="'collapse-child-list-' + id"
  20. @click.stop="visible = !visible"
  21. variant="dark"
  22. block
  23. >
  24. {{ $t('children')}} <span class="collapse-icon" :class="{ collapsed: !visible }">></span>
  25. </b-button>
  26. </nav>
  27. </template>
  28. <script>
  29. export default {
  30. name: 'NodeViewChildListGroup',
  31. props: {
  32. children: { type: Array, required: true },
  33. id: { type: Number, required: true }
  34. },
  35. data () {
  36. return {
  37. visible: window.innerWidth > 769
  38. }
  39. }
  40. }
  41. </script>
  42. <style lang="scss" scoped>
  43. .node-view-child-list-group {
  44. position: relative;
  45. z-index: 1;
  46. .list-group {
  47. font-family: $font-family-base;
  48. font-weight: $font-weight-bold;
  49. @include media-breakpoint-up($size-bp) {
  50. font-size: 1.75rem;
  51. }
  52. }
  53. .btn-children {
  54. display: flex;
  55. border-radius: 0 !important;
  56. font-weight: $font-weight-bold;
  57. padding: $list-group-item-padding-y $list-group-item-padding-x;
  58. .collapse-icon {
  59. font-weight: inherit;
  60. margin-left: auto;
  61. transform: translate(15px, 0px) rotate(270deg);
  62. &.collapsed {
  63. transform: translate(-3px, 0px) rotate(90deg) ;
  64. }
  65. }
  66. @include media-breakpoint-up('tb') {
  67. display: none;
  68. }
  69. }
  70. }
  71. </style>