Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

GlobalSearch.vue 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <!--
  2. - @copyright Copyright (c) 2020 Fon E. Noel NFEBE <fenn25.fn@gmail.com>
  3. -
  4. - @author Fon E. Noel NFEBE <fenn25.fn@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. <div class="header-menu">
  24. <NcButton class="global-search__button" :aria-label="t('core', 'Unified search')" @click="toggleGlobalSearch">
  25. <template #icon>
  26. <Magnify class="global-search__trigger" :size="22" />
  27. </template>
  28. </NcButton>
  29. <GlobalSearchModal :class="'global-search-modal'" :is-visible="showGlobalSearch" @update:isVisible="handleModalVisibilityChange" />
  30. </div>
  31. </template>
  32. <script>
  33. import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
  34. import Magnify from 'vue-material-design-icons/Magnify.vue'
  35. import GlobalSearchModal from './GlobalSearchModal.vue'
  36. export default {
  37. name: 'GlobalSearch',
  38. components: {
  39. NcButton,
  40. Magnify,
  41. GlobalSearchModal,
  42. },
  43. data() {
  44. return {
  45. showGlobalSearch: false,
  46. }
  47. },
  48. mounted() {
  49. console.debug('Global search initialized!')
  50. },
  51. methods: {
  52. toggleGlobalSearch() {
  53. this.showGlobalSearch = !this.showGlobalSearch
  54. },
  55. handleModalVisibilityChange(newVisibilityVal) {
  56. this.showGlobalSearch = newVisibilityVal
  57. },
  58. },
  59. }
  60. </script>
  61. <style lang="scss" scoped>
  62. .header-menu {
  63. display: flex;
  64. align-items: center;
  65. justify-content: center;
  66. .global-search__button {
  67. display: flex;
  68. align-items: center;
  69. justify-content: center;
  70. width: var(--header-height);
  71. // height: var(--header-height);
  72. margin: 0;
  73. padding: 0;
  74. cursor: pointer;
  75. opacity: .85;
  76. background-color: transparent;
  77. border: none;
  78. filter: none !important;
  79. color: var(--color-primary-text) !important;
  80. &:hover {
  81. background-color: transparent !important;
  82. }
  83. }
  84. }
  85. .global-search-modal {
  86. ::v-deep .modal-container {
  87. height: 80%;
  88. }
  89. }
  90. </style>