_dropdown.scss 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. // =============================================================================
  2. // Listing view smaller dropdowns
  3. // =============================================================================
  4. .c-dropdown.hidden {
  5. display: none;
  6. }
  7. .c-dropdown__button {
  8. display: inline-block;
  9. padding-inline-start: 0.5rem;
  10. padding-inline-end: 0.25rem;
  11. // Make this the same as the other buttons
  12. line-height: 1.85;
  13. border: solid 1px transparent;
  14. border-radius: 2px;
  15. font-size: 0.95em;
  16. cursor: pointer;
  17. -webkit-font-smoothing: subpixel-antialiased;
  18. user-select: none;
  19. }
  20. .c-dropdown--large .c-dropdown__button {
  21. line-height: 2.9em;
  22. padding-inline-start: 0.5rem;
  23. padding-inline-end: 0.5rem;
  24. .icon-site {
  25. padding-inline-end: 0.2rem;
  26. }
  27. }
  28. .c-dropdown__icon {
  29. padding-inline-start: 0.4rem;
  30. padding-inline-end: 0.4rem;
  31. }
  32. .c-dropdown__toggle {
  33. display: inline-block;
  34. }
  35. .c-dropdown__togle--icon {
  36. &:before {
  37. display: none; // TODO: remove when iconfont styles are removed
  38. }
  39. .icon {
  40. @include svg-icon(1em, middle);
  41. }
  42. .icon-arrow-up {
  43. display: none;
  44. }
  45. }
  46. .is-open .c-dropdown__togle--icon {
  47. .icon-arrow-up {
  48. display: inline-block;
  49. }
  50. .icon-arrow-down {
  51. display: none;
  52. }
  53. }
  54. .c-dropdown__menu.c-dropdown__menu {
  55. margin-top: 0.75rem;
  56. padding: 0.75rem 1rem;
  57. min-width: 8rem;
  58. position: absolute;
  59. z-index: 1000;
  60. animation: dropdownIn 0.1s ease-out backwards;
  61. list-style: none;
  62. // Override any right alignment that might've been set by a parent element
  63. // (such as the snippets header)
  64. text-align: start;
  65. @media (forced-colors: active) {
  66. border: 2px solid transparent;
  67. }
  68. }
  69. .c-dropdown__item {
  70. margin-bottom: 0.375rem;
  71. font-size: 0.8rem;
  72. &:hover {
  73. .c-dropdown__indicator {
  74. opacity: 0.6;
  75. }
  76. }
  77. }
  78. .c-dropdown__item:last-child {
  79. margin-bottom: 0;
  80. }
  81. @keyframes dropdownIn {
  82. 0% {
  83. opacity: 0;
  84. }
  85. 100% {
  86. opacity: 1;
  87. }
  88. }