NodeViewHeaderProd.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <div
  3. class="node-view-header-prod" :class="'node-view-header-' + mode"
  4. >
  5. <div class="node-view-header-wrapper d-flex w-100">
  6. <h4 class="mr-auto">
  7. <div class="node-view-header-type">
  8. {{ $t('variants.' + node.variant) }} {{ withOrigin ? $t('from') : '' }}
  9. </div>
  10. <div v-if="withOrigin" class="node-view-header-parent">
  11. <node-view-title :node="node.parents[0]" edition tag="div" />
  12. </div>
  13. </h4>
  14. <button-close v-if="mode === 'view'" @click="onClose()" />
  15. </div>
  16. </div>
  17. </template>
  18. <script>
  19. import { trim, toCommaList } from '@/helpers/common'
  20. import { NodeViewTitle } from '@/components/nodes'
  21. export default {
  22. name: 'NodeViewHeaderProd',
  23. components: {
  24. NodeViewTitle
  25. },
  26. props: {
  27. node: { type: Object, required: true },
  28. mode: { type: String, required: true },
  29. showOrigin: { type: Boolean, required: true },
  30. firstChar: { type: [String, null], default: null }
  31. },
  32. computed: {
  33. parent () {
  34. if (!this.node || !this.node.parents) return
  35. return this.node.parents.find(parent => parent.variant === 'depart')
  36. },
  37. withOrigin () {
  38. return (this.showOrigin || this.mode === 'card') && this.node.parents && this.node.parents.length
  39. }
  40. },
  41. methods: {
  42. trim,
  43. toCommaList,
  44. onClose () {
  45. this.$parent.$emit('close-node', this.node.id)
  46. }
  47. }
  48. }
  49. </script>
  50. <style lang="scss" scoped>
  51. .node-view-header {
  52. &-prod {
  53. font: {
  54. family: $font-family-base;
  55. font-weight: $font-weight-bold;
  56. size: inherit;
  57. line-height: inherit;
  58. }
  59. @each $color, $value in $theme-colors {
  60. .node-view-#{$color} & {
  61. color: darken($value, 32%);
  62. }
  63. }
  64. }
  65. &-parent {
  66. font-family: $font-family-text;
  67. }
  68. &-card {
  69. h4 {
  70. font-size: 0.8rem;
  71. @include media-breakpoint-up($size-bp) {
  72. font-size: 1.25rem;
  73. }
  74. }
  75. }
  76. &-view {
  77. h4 {
  78. font-size: 1rem;
  79. @include media-breakpoint-up($size-bp) {
  80. font-size: 1.4525rem;
  81. }
  82. }
  83. }
  84. .btn-close {
  85. position: relative;
  86. display: flex;
  87. float: right;
  88. @include media-breakpoint-up($layout-bp) {
  89. right: -13px;
  90. }
  91. }
  92. }
  93. </style>