You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PredefinedStatus.vue 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <!--
  2. - @copyright Copyright (c) 2020 Georg Ehrke <oc.list@georgehrke.com>
  3. - @author Georg Ehrke <oc.list@georgehrke.com>
  4. -
  5. - @license GNU AGPL version 3 or any later version
  6. -
  7. - This program is free software: you can redistribute it and/or modify
  8. - it under the terms of the GNU Affero General Public License as
  9. - published by the Free Software Foundation, either version 3 of the
  10. - License, or (at your option) any later version.
  11. -
  12. - This program is distributed in the hope that it will be useful,
  13. - but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. - GNU Affero General Public License for more details.
  16. -
  17. - You should have received a copy of the GNU Affero General Public License
  18. - along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. -
  20. -->
  21. <template>
  22. <div
  23. class="predefined-status"
  24. tabindex="0"
  25. @keyup.enter="select"
  26. @keyup.space="select"
  27. @click="select">
  28. <span class="predefined-status__icon">
  29. {{ icon }}
  30. </span>
  31. <span class="predefined-status__message">
  32. {{ message }}
  33. </span>
  34. <span class="predefined-status__clear-at">
  35. {{ clearAt | clearAtFilter }}
  36. </span>
  37. </div>
  38. </template>
  39. <script>
  40. import { clearAtFilter } from '../filters/clearAtFilter'
  41. export default {
  42. name: 'PredefinedStatus',
  43. filters: {
  44. clearAtFilter,
  45. },
  46. props: {
  47. messageId: {
  48. type: String,
  49. required: true,
  50. },
  51. icon: {
  52. type: String,
  53. required: true,
  54. },
  55. message: {
  56. type: String,
  57. required: true,
  58. },
  59. clearAt: {
  60. type: Object,
  61. required: false,
  62. default: null,
  63. },
  64. },
  65. methods: {
  66. /**
  67. * Emits an event when the user clicks the row
  68. */
  69. select() {
  70. this.$emit('select')
  71. },
  72. },
  73. }
  74. </script>
  75. <style lang="scss" scoped>
  76. .predefined-status {
  77. display: flex;
  78. flex-wrap: nowrap;
  79. justify-content: flex-start;
  80. flex-basis: 100%;
  81. border-radius: var(--border-radius);
  82. align-items: center;
  83. min-height: 44px;
  84. &:hover,
  85. &:focus {
  86. background-color: var(--color-background-hover);
  87. }
  88. &__icon {
  89. flex-basis: 40px;
  90. text-align: center;
  91. }
  92. &__message {
  93. font-weight: bold;
  94. padding: 0 6px;
  95. }
  96. &__clear-at {
  97. opacity: .7;
  98. &::before {
  99. content: ' - ';
  100. }
  101. }
  102. }
  103. </style>