_search.scss 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. // Search
  2. .td-search {
  3. background: transparent;
  4. position: relative;
  5. width: 100%;
  6. // Search icon
  7. &__icon {
  8. // Vertically center the content.
  9. display: flex;
  10. align-items: center;
  11. height: 100%;
  12. // Position this on the left of the input.
  13. position: absolute;
  14. left: 0.75em;
  15. // Click-through to the underlying input.
  16. pointer-events: none;
  17. &::before {
  18. @extend .fa;
  19. content: fa-content($fa-var-search);
  20. }
  21. // Styling adjustments for the navbar
  22. @at-root {
  23. .td-navbar & {
  24. color: inherit;
  25. }
  26. }
  27. }
  28. // Search input element
  29. &__input {
  30. width: 100%;
  31. text-indent: 1.25em;
  32. &:not(:focus) {
  33. background: transparent;
  34. }
  35. &.form-control:focus {
  36. border-color: tint-color($primary, 95%);
  37. box-shadow: 0 0 0 2px tint-color($primary, 40%);
  38. color: var(--bs-body-color);
  39. }
  40. // Styling adjustments for the navbar
  41. @at-root {
  42. .td-navbar & {
  43. border: none;
  44. color: inherit;
  45. @include placeholder {
  46. color: inherit;
  47. }
  48. }
  49. }
  50. }
  51. // Hide icon on focus
  52. &:focus-within {
  53. .td-search__icon {
  54. display: none;
  55. }
  56. .td-search-input {
  57. text-indent: 0;
  58. }
  59. }
  60. &:not(:focus-within) {
  61. color: $input-placeholder-color;
  62. }
  63. }
  64. .td-sidebar .td-search--algolia {
  65. display: block;
  66. padding: 0 0.5rem;
  67. > button {
  68. margin: 0;
  69. width: 100%;
  70. }
  71. }
  72. // Offline search
  73. .td-search--offline {
  74. &:focus-within {
  75. // Don't hide the search icon on focus: this gives better UX when user
  76. // explores content of search-results popup and focus is lost.
  77. .td-search__icon {
  78. display: flex;
  79. color: $input-placeholder-color;
  80. }
  81. }
  82. }
  83. .td-offline-search-results {
  84. max-width: 90%;
  85. .card {
  86. margin-bottom: $spacer * 0.5;
  87. .card-header {
  88. font-weight: bold;
  89. }
  90. }
  91. &__close-button {
  92. // cursor: pointer;
  93. float: right;
  94. &::after {
  95. @extend .fas;
  96. content: fa-content($fa-var-times);
  97. }
  98. }
  99. }