_dropdown.legacy.scss 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. .dropdown {
  2. @include clearfix();
  3. position: relative;
  4. input[type=submit],
  5. input[type=reset],
  6. input[type=button],
  7. button,
  8. .button {
  9. padding: 0 5em 0 1em;
  10. display: block;
  11. width: 100%;
  12. height: 3em;
  13. line-height: 3em;
  14. text-align: left;
  15. float: left;
  16. }
  17. .action-secondary {
  18. opacity: 0.8;
  19. }
  20. input[type=submit],
  21. input[type=reset],
  22. input[type=button],
  23. button {
  24. line-height: inherit;
  25. }
  26. ul {
  27. @include unlist();
  28. background-color: $color-teal;
  29. position: absolute;
  30. overflow: hidden;
  31. top: 100%;
  32. left: -2000px;
  33. z-index: 500;
  34. opacity: 0;
  35. li {
  36. float: none;
  37. border-color: rgba(255, 255, 255, 0.2);
  38. border-style: solid;
  39. border-width: 1px 0 0;
  40. overflow: hidden;
  41. a:focus,
  42. button:focus {
  43. border: 3px solid $color-focus-outline;
  44. }
  45. }
  46. // Media for Windows High Contrast
  47. @media (forced-colors: $media-forced-colours) {
  48. li a,
  49. li button {
  50. forced-color-adjust: none;
  51. background-color: $color-black;
  52. border-color: $color-white;
  53. color: $color-white;
  54. }
  55. li a:focus,
  56. li button:focus {
  57. background-color: $color-black;
  58. forced-color-adjust: none;
  59. border: 4px solid #0ff;
  60. color: $color-white;
  61. }
  62. }
  63. a {
  64. box-sizing: border-box;
  65. white-space: nowrap;
  66. position: relative;
  67. text-decoration: none;
  68. text-transform: uppercase;
  69. display: block;
  70. color: $color-white;
  71. padding: 1em;
  72. font-weight: normal;
  73. &:hover {
  74. background-color: $color-teal-darker;
  75. }
  76. &.icon {
  77. padding-right: 5em;
  78. // stylelint-disable-next-line max-nesting-depth
  79. &:before,
  80. &:after {
  81. right: 1em;
  82. }
  83. }
  84. &.shortcut {
  85. padding-right: 7em;
  86. }
  87. }
  88. a,
  89. input[type=submit],
  90. input[type=reset],
  91. input[type=button],
  92. .button,
  93. button {
  94. border-radius: 0;
  95. font-size: 0.95em;
  96. -webkit-font-smoothing: auto;
  97. }
  98. label {
  99. padding: 1.3em;
  100. }
  101. .kbd {
  102. position: absolute;
  103. right: 1em;
  104. font-weight: 600;
  105. font-size: 0.8em;
  106. color: rgba(0, 0, 0, 0.3);
  107. }
  108. }
  109. &.open ul {
  110. box-shadow: 0 3px 3px 0 rgba(0, 0, 0, 0.2);
  111. opacity: 1;
  112. left: 0;
  113. display: block;
  114. }
  115. &.match-width ul {
  116. width: 100%;
  117. min-width: 110px;
  118. li {
  119. white-space: nowrap;
  120. }
  121. }
  122. &.dropup ul {
  123. box-shadow: 0 -3px 3px 0 rgba(0, 0, 0, 0.2);
  124. top: auto;
  125. bottom: 100%;
  126. li {
  127. border-width: 0 0 1px;
  128. }
  129. }
  130. .dropdown-toggle {
  131. color: $color-white;
  132. text-transform: uppercase;
  133. background-color: $color-teal;
  134. line-height: 2.8em;
  135. cursor: pointer;
  136. height: 100%;
  137. border-left: 1px solid rgba(255, 255, 255, 0.2);
  138. position: absolute;
  139. right: 0;
  140. padding: 0 0.5em;
  141. text-align: center;
  142. &:before,
  143. &:after {
  144. margin: 0;
  145. }
  146. &:before {
  147. width: 1em;
  148. font-size: 1.2rem;
  149. }
  150. &:hover {
  151. background-color: $color-teal-darker;
  152. }
  153. svg.icon { // TODO: remove svg qualifier once the icon font styles are gone
  154. @include svg-icon(1.3em);
  155. }
  156. }
  157. .bicolor + .dropdown-toggle {
  158. background-color: $color-teal-darker;
  159. &:hover {
  160. background-color: $color-teal-dark;
  161. }
  162. }
  163. &.open .dropdown-toggle {
  164. background-color: $color-teal-darker;
  165. }
  166. .bicolor:hover {
  167. background-color: $color-teal-dark;
  168. }
  169. // Styles for dropdowns which are also buttons e.g page editor
  170. &.dropdown-button {
  171. .dropdown-toggle {
  172. border-radius: 0 3px 3px 0;
  173. }
  174. &.open {
  175. > input[type=button],
  176. > input[type=submit],
  177. > button,
  178. > .button {
  179. border-radius: 3px 3px 0 0;
  180. }
  181. .dropdown-toggle {
  182. border-radius: 0 3px 0 0;
  183. }
  184. }
  185. }
  186. &.dropdown-button--white {
  187. ul {
  188. background-color: $color-grey-3;
  189. }
  190. li a,
  191. li .button {
  192. background-color: $color-white;
  193. color: $color-button;
  194. border: 0;
  195. &:hover {
  196. background-color: $color-grey-4;
  197. }
  198. &.no {
  199. color: $color-button-no;
  200. }
  201. &.warning {
  202. color: $color-button-warning;
  203. }
  204. }
  205. }
  206. &.dropup.dropdown-button {
  207. &.open {
  208. > input[type=button],
  209. > input[type=submit],
  210. > button,
  211. > .button {
  212. border-radius: 0 0 3px 3px;
  213. }
  214. .dropdown-toggle {
  215. border-radius: 0 0 3px;
  216. }
  217. }
  218. }
  219. }
  220. .dropdown.white {
  221. ul {
  222. background-color: $color-white;
  223. li {
  224. border-top: 1px solid rgba(0, 0, 0, 0.1);
  225. }
  226. a {
  227. color: $color-grey-2;
  228. &:hover {
  229. background-color: $color-grey-3;
  230. }
  231. }
  232. }
  233. }
  234. .dropdown.warning {
  235. ul {
  236. background-color: $color-button-warning;
  237. }
  238. .dropdown-toggle {
  239. background-color: $color-button-warning;
  240. &:hover {
  241. background-color: $color-button-warning-hover;
  242. }
  243. }
  244. }
  245. // Transitions
  246. .dropdown ul {
  247. @include transition(opacity 0.2s linear);
  248. }
  249. .dropdown-button {
  250. .button svg.icon { // TODO: leave only class when iconfont styles are removed
  251. @include svg-icon();
  252. margin-right: 0.5em;
  253. }
  254. }