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.

PrimaryActionButton.vue 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <!--
  2. - @copyright 2021, Christopher Ng <chrng8@gmail.com>
  3. -
  4. - @author Christopher Ng <chrng8@gmail.com>
  5. -
  6. - @license GNU AGPL version 3 or any later version
  7. -
  8. - This program is free software: you can redistribute it and/or modify
  9. - it under the terms of the GNU Affero General Public License as
  10. - published by the Free Software Foundation, either version 3 of the
  11. - License, or (at your option) any later version.
  12. -
  13. - This program is distributed in the hope that it will be useful,
  14. - but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. - GNU Affero General Public License for more details.
  17. -
  18. - You should have received a copy of the GNU Affero General Public License
  19. - along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. -
  21. -->
  22. <template>
  23. <NcButton type="primary"
  24. :href="href"
  25. alignment="center"
  26. :target="target"
  27. :disabled="disabled">
  28. <template #icon>
  29. <img class="icon"
  30. aria-hidden="true"
  31. :src="icon"
  32. alt="">
  33. </template>
  34. <slot />
  35. </NcButton>
  36. </template>
  37. <script>
  38. import { defineComponent } from 'vue'
  39. import { NcButton } from '@nextcloud/vue'
  40. import { translate as t } from '@nextcloud/l10n'
  41. export default defineComponent({
  42. name: 'PrimaryActionButton',
  43. components: {
  44. NcButton,
  45. },
  46. props: {
  47. disabled: {
  48. type: Boolean,
  49. default: false,
  50. },
  51. href: {
  52. type: String,
  53. required: true,
  54. },
  55. icon: {
  56. type: String,
  57. required: true,
  58. },
  59. target: {
  60. type: String,
  61. required: true,
  62. validator: (value) => ['_self', '_blank', '_parent', '_top'].includes(value),
  63. },
  64. },
  65. methods: {
  66. t,
  67. },
  68. })
  69. </script>
  70. <style lang="scss" scoped>
  71. .icon {
  72. filter: var(--primary-invert-if-dark);
  73. }
  74. </style>