NodeViewHeaderRef.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <div
  3. class="node-view-header-ref" :class="'node-view-header-' + mode"
  4. >
  5. <div class="node-view-header-wrapper w-100">
  6. <div class="nav-container" :style="`--offset: ${offset}px;`">
  7. <node-view-child-list
  8. v-if="mode === 'view' && node.children && node.children.length"
  9. :children="node.children"
  10. @open-child="$parent.$emit('open-child', $event)"
  11. />
  12. <button-close v-if="mode === 'view'" @click="onClose()" />
  13. </div>
  14. <node-view-title
  15. :node="node" tag="h4"
  16. block edition
  17. class="mr-auto"
  18. />
  19. </div>
  20. </div>
  21. </template>
  22. <script>
  23. import { trim, toCommaList } from '@/helpers/common'
  24. import { NodeViewChildList, NodeViewTitle } from '@/components/nodes'
  25. export default {
  26. name: 'NodeViewHeaderRef',
  27. components: {
  28. NodeViewChildList,
  29. NodeViewTitle
  30. },
  31. props: {
  32. node: { type: Object, required: true },
  33. mode: { type: String, required: true }
  34. },
  35. data () {
  36. return {
  37. offset: 0
  38. }
  39. },
  40. methods: {
  41. trim,
  42. toCommaList,
  43. onClose () {
  44. this.$parent.$emit('close-node', this.node.id)
  45. }
  46. },
  47. mounted () {
  48. const parentContH = this.$el.parentElement.offsetWidth
  49. const parentH = this.$el.parentElement.parentElement.offsetWidth
  50. this.offset = (parentH - parentContH) * -1
  51. }
  52. }
  53. </script>
  54. <style lang="scss">
  55. .node-view-header {
  56. &-ref {
  57. font-family: $font-family-text;
  58. }
  59. .nav-container {
  60. position: relative;
  61. display: flex;
  62. float: right;
  63. @include media-breakpoint-up($layout-bp) {
  64. right: var(--offset);
  65. }
  66. }
  67. // ╭─╴╭─┐┌─╮┌─╮
  68. // │ ├─┤├┬╯│ │
  69. // ╰─╴╵ ╵╵ ╰└─╯
  70. &-card {
  71. h4 {
  72. font-size: 1.1rem;
  73. .edition {
  74. font-size: 0.65rem;
  75. }
  76. @include media-breakpoint-up($size-bp) {
  77. font-size: 2rem;
  78. .edition {
  79. font-size: 1.15rem;
  80. }
  81. }
  82. }
  83. }
  84. // ╷ ╷╶┬╴┌─╴╷╷╷
  85. // │╭╯ │ ├─╴│││
  86. // ╰╯ ╶┴╴╰─╴╰╯╯
  87. &-view {
  88. h4 {
  89. font-size: 1.25rem;
  90. .edition {
  91. font-size: 0.75rem;
  92. }
  93. @include media-breakpoint-up($size-bp) {
  94. font-size: 2.625rem;
  95. .edition {
  96. font-size: 1.5rem;
  97. }
  98. }
  99. }
  100. .node-view-child-list {
  101. display: none;
  102. @include media-breakpoint-up($layout-bp) {
  103. display: block;
  104. }
  105. }
  106. }
  107. }
  108. </style>