header-search-wide.pcss.css

Same filename in other branches
  1. 9 core/themes/olivero/css/components/header-search-wide.pcss.css
  2. 10 core/themes/olivero/css/components/header-search-wide.pcss.css

Header Search Wide Block.

File

core/themes/olivero/css/components/header-search-wide.pcss.css

View source
  1. /**
  2. * @file
  3. * Header Search Wide Block.
  4. */
  5. @import "../base/media-queries.pcss.css";
  6. /* Override contextual links so we can position against .site-header. */
  7. .block-search-wide.contextual-region {
  8. position: static;
  9. }
  10. .block-search-wide__wrapper {
  11. position: absolute;
  12. z-index: 1; /* Ensure left border shows above social region in IE11. */
  13. inset-block-start: 100%;
  14. inset-inline-start: calc(-1 * var(--content-left));
  15. display: none;
  16. visibility: hidden;
  17. overflow: hidden;
  18. width: calc(100% + var(--content-left));
  19. max-width: var(--max-bg-color);
  20. height: var(--sp8);
  21. max-height: 0;
  22. margin-block: 0;
  23. margin-inline-start: 0;
  24. margin-inline-end: 0;
  25. padding-block: 0;
  26. padding-inline-start: 0;
  27. padding-inline-end: 0;
  28. transition: all 0.2s;
  29. border-inline-start: solid var(--content-left) var(--color--gray-20);
  30. background: var(--color--black);
  31. &.is-active {
  32. visibility: visible;
  33. max-height: var(--sp8);
  34. }
  35. & form {
  36. display: flex;
  37. grid-column: 1 / 14;
  38. }
  39. & input[type="search"] {
  40. width: calc(100% + var(--sp2));
  41. height: var(--sp8);
  42. padding-block: 0;
  43. padding-inline-start: var(--sp12);
  44. padding-inline-end: 0;
  45. transition: background-size 0.4s;
  46. color: var(--color--white);
  47. border: solid 1px transparent;
  48. box-shadow: none;
  49. font-family: var(--font-serif);
  50. font-size: 32px;
  51. -webkit-appearance: none;
  52. &:focus {
  53. outline: solid 4px transparent;
  54. outline-offset: -4px;
  55. }
  56. }
  57. & .form-item-keys {
  58. flex-grow: 1;
  59. margin: 0;
  60. }
  61. & .form-actions {
  62. display: flex;
  63. margin: 0;
  64. }
  65. & .search-form__submit {
  66. position: relative;
  67. overflow: hidden;
  68. align-self: stretch;
  69. width: 100px;
  70. height: auto;
  71. margin-block: 0;
  72. margin-inline-start: 0;
  73. margin-inline-end: 0;
  74. padding-block: 0;
  75. padding-inline-start: 0;
  76. padding-inline-end: 0;
  77. cursor: pointer;
  78. border-color: transparent;
  79. background-color: transparent;
  80. /*
  81. When in Windows high contrast mode, FF will not output either background
  82. images or SVGs that are nested directly within a element, so we add a .
  83. */
  84. & .icon--search {
  85. position: absolute;
  86. inset-block-start: 0;
  87. inset-inline-end: 0;
  88. display: block;
  89. width: 24px; /* Width of the SVG background image. */
  90. height: 100%;
  91. pointer-events: none;
  92. background-image: url("../../images/search--white.svg");
  93. background-repeat: no-repeat;
  94. background-position: center;
  95. background-size: contain;
  96. &::after {
  97. position: absolute;
  98. inset-block-end: 0;
  99. inset-inline-start: 0;
  100. width: 100%;
  101. height: 0;
  102. content: "";
  103. transition: transform 0.2s;
  104. transform: scaleX(0);
  105. transform-origin: left;
  106. border-block-start: solid var(--sp0-5) var(--color--primary-50);
  107. }
  108. }
  109. &:focus {
  110. outline: solid 4px transparent;
  111. outline-offset: -4px;
  112. box-shadow: none;
  113. & span::after {
  114. transform: scaleX(1);
  115. }
  116. @media screen and (-ms-high-contrast: active) {
  117. border-bottom-width: var(--sp0-5);
  118. & span::after {
  119. content: none;
  120. }
  121. }
  122. }
  123. @media screen and (-ms-high-contrast: active) {
  124. /* Edge's high contrast does show the background image, so we hide it. */
  125. & .icon--search {
  126. display: none;
  127. }
  128. }
  129. }
  130. }
  131. .block-search-wide__container {
  132. max-width: var(--max-width);
  133. padding-inline-end: var(--sp2);
  134. }
  135. .block-search-wide__grid {
  136. display: grid;
  137. grid-template-columns: repeat(var(--grid-col-count), 1fr);
  138. grid-column-gap: var(--grid-gap);
  139. }
  140. /* Override specificity from container-inline.module.css */
  141. .container-inline {
  142. & .block-search-wide__container {
  143. display: block;
  144. }
  145. & .block-search-wide__grid {
  146. display: grid;
  147. }
  148. }
  149. .block-search-wide__button {
  150. position: relative;
  151. display: none;
  152. width: var(--sp3);
  153. height: var(--sp6);
  154. cursor: pointer;
  155. color: var(--color-text-neutral-loud); /* Affects SVG search icon. */
  156. border: 0;
  157. background: transparent;
  158. -webkit-appearance: none;
  159. &:focus {
  160. position: relative;
  161. outline: 0;
  162. &::after {
  163. position: absolute;
  164. top: 50%;
  165. left: 50%;
  166. width: 80%;
  167. height: var(--sp3);
  168. content: "";
  169. transform: translate(-50%, -50%);
  170. border: solid 2px var(--color--primary-50);
  171. border-radius: 4px;
  172. }
  173. }
  174. &[aria-expanded="true"] {
  175. background: var(--color--black);
  176. &:focus::after {
  177. border-color: var(--color--white);
  178. }
  179. & .block-search-wide__button-close {
  180. &::before,
  181. &::after {
  182. position: absolute;
  183. top: 50%;
  184. left: 50%;
  185. width: var(--sp1-5);
  186. height: 0;
  187. content: "";
  188. border-block-start: solid 2px var(--color--white);
  189. }
  190. &::before {
  191. transform: translate(-50%, -50%) rotate(-45deg);
  192. }
  193. &::after {
  194. transform: translate(-50%, -50%) rotate(45deg);
  195. }
  196. }
  197. & svg {
  198. display: none;
  199. }
  200. }
  201. & svg {
  202. margin-inline-start: auto;
  203. margin-inline-end: auto;
  204. }
  205. @media (forced-colors: active) {
  206. background: ButtonFace;
  207. & path {
  208. fill: ButtonText;
  209. }
  210. }
  211. }
  212. /* Provide rudimentary access to site search if JS is disabled. */
  213. html:not(.js) .search-block-form:focus-within .block-search-wide__wrapper {
  214. visibility: visible;
  215. max-height: var(--sp8);
  216. }
  217. /* Necessary to override specificity of transpiled PostCSS properties from default input focus styling. */
  218. [dir] .block-search-wide__wrapper input[type="search"] {
  219. background-color: transparent;
  220. background-image: linear-gradient(var(--color--primary-50), var(--color--primary-50)); /* Two values are needed for IE11 support. */
  221. background-repeat: no-repeat;
  222. background-position: bottom left; /* LTR */
  223. background-size: 0% 10px;
  224. &:focus {
  225. background-size: 100% var(--sp0-5);
  226. }
  227. }
  228. [dir="rtl"] .block-search-wide__wrapper {
  229. & input[type="search"] {
  230. background-position: bottom right;
  231. }
  232. & .search-form__submit .icon--search::after {
  233. transform-origin: right;
  234. }
  235. }
  236. body:not(.is-always-mobile-nav) {
  237. & .block-search-wide__wrapper,
  238. & .block-search-wide__button {
  239. @media (--nav) {
  240. display: block;
  241. }
  242. }
  243. }

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.