search_bar.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <div
  3. class="SearchBar"
  4. :class="{ '-expanded': !hidden }"
  5. >
  6. <button
  7. v-if="hidden"
  8. class="button-unstyled nav-icon"
  9. :title="$t('nav.search')"
  10. type="button"
  11. @click.prevent.stop="toggleHidden"
  12. >
  13. <FAIcon
  14. fixed-width
  15. class="fa-scale-110 fa-old-padding"
  16. icon="search"
  17. />
  18. </button>
  19. <template v-else>
  20. <input
  21. id="search-bar-input"
  22. ref="searchInput"
  23. v-model="searchTerm"
  24. class="search-bar-input"
  25. :placeholder="$t('nav.search')"
  26. type="text"
  27. @keyup.enter="find(searchTerm)"
  28. >
  29. <button
  30. class="button-default search-button"
  31. type="submit"
  32. @click="find(searchTerm)"
  33. >
  34. <FAIcon
  35. fixed-width
  36. icon="search"
  37. />
  38. </button>
  39. <button
  40. class="button-unstyled cancel-search"
  41. type="button"
  42. @click.prevent.stop="toggleHidden"
  43. >
  44. <FAIcon
  45. fixed-width
  46. icon="times"
  47. class="cancel-icon fa-scale-110 fa-old-padding"
  48. />
  49. </button>
  50. </template>
  51. </div>
  52. </template>
  53. <script src="./search_bar.js"></script>
  54. <style lang="scss">
  55. @import '../../_variables.scss';
  56. .SearchBar {
  57. display: inline-flex;
  58. align-items: baseline;
  59. vertical-align: baseline;
  60. justify-content: flex-end;
  61. &.-expanded {
  62. width: 100%;
  63. }
  64. .search-bar-input,
  65. .search-button {
  66. height: 29px;
  67. }
  68. .search-bar-input {
  69. flex: 1 0 auto;
  70. }
  71. .cancel-search {
  72. height: 50px;
  73. }
  74. .cancel-icon {
  75. color: $fallback--text;
  76. color: var(--btnTopBarText, $fallback--text);
  77. }
  78. }
  79. </style>