MetricButton.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <!--
  2. Button which displays the information for a used metric and is used to select for which
  3. metric the distribution and comparisons are displayed.
  4. -->
  5. <template>
  6. <div class="wrapper" v-bind:class="{ selected: isSelected }">
  7. <div>
  8. <p class="metric-name">{{ metric.metricName }}</p>
  9. <div class="tooltip">
  10. <img alt="?" src="@/assets/help_outline_black_18dp.svg" />
  11. <span class="tooltiptext">{{metric.description}}</span>
  12. </div>
  13. </div>
  14. </div>
  15. </template>
  16. <script lang="ts">
  17. import { defineComponent, PropType } from "vue";
  18. import { Metric } from "@/model/Metric";
  19. export default defineComponent({
  20. name: "MetricButton",
  21. props: {
  22. metric: {
  23. type: Object as PropType<Metric>,
  24. required: true,
  25. },
  26. isSelected: {
  27. type: Boolean,
  28. default: false,
  29. },
  30. },
  31. setup() {
  32. return {};
  33. },
  34. });
  35. </script>
  36. <style scoped>
  37. .wrapper {
  38. display: flex;
  39. flex-direction: column;
  40. background: white;
  41. border-radius: 5px;
  42. box-shadow: #777777 2px 3px 3px;
  43. padding: 5%;
  44. margin-right: 5%;
  45. }
  46. .wrapper > div > * {
  47. margin: 0;
  48. padding: 0;
  49. }
  50. .wrapper > div {
  51. display: flex;
  52. justify-content: space-between;
  53. }
  54. .wrapper:hover {
  55. background: var(--secondary-color-dark);
  56. color: white;
  57. }
  58. .metric-name {
  59. font-size: xx-large;
  60. font-weight: bold;
  61. margin: 0;
  62. }
  63. .threshold {
  64. font-size: small;
  65. font-weight: bold;
  66. }
  67. .selected {
  68. background: var(--secondary-color);
  69. box-shadow: var(--shadow-color) 2px 3px 3px;
  70. }
  71. .selected p {
  72. color: white;
  73. }
  74. .tooltip {
  75. position: relative;
  76. display: inline-block;
  77. }
  78. .tooltip .tooltiptext {
  79. visibility: hidden;
  80. width: 240px;
  81. background-color: black;
  82. color: #fff;
  83. text-align: center;
  84. padding: 10px ;
  85. border-radius: 6px;
  86. position: absolute;
  87. z-index: 1;
  88. }
  89. .tooltip:hover .tooltiptext {
  90. visibility: visible;
  91. }
  92. </style>