_nav.scss 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. $navbar-breakpoint: lg;
  2. .navbar {
  3. justify-content: center;
  4. display: flex;
  5. >:last-child {
  6. margin-right: 0;
  7. }
  8. }
  9. .navbar-toggle {
  10. cursor: pointer;
  11. border: 0;
  12. display: flex;
  13. width: 2rem;
  14. height: 2rem;
  15. border-radius: $border-radius;
  16. align-items: center;
  17. justify-content: center;
  18. background: transparent;
  19. color: inherit;
  20. position: relative;
  21. &:hover .navbar-burger {
  22. opacity: 1;
  23. }
  24. span {
  25. display: block;
  26. position: absolute;
  27. height: 3px;
  28. width: 100%;
  29. background: currentColor;
  30. border-radius: 9px;
  31. opacity: 1;
  32. left: 0;
  33. transform: rotate(0deg);
  34. transition: $transition-duration-short ease-in-out;
  35. &:nth-child(1) {
  36. top: 5px;
  37. transform-origin: center;
  38. }
  39. &:nth-child(2),
  40. &:nth-child(3){
  41. top: 15px;
  42. transform-origin: center;
  43. }
  44. &:nth-child(4) {
  45. top: 25px;
  46. transform-origin: center;
  47. }
  48. }
  49. &.active {
  50. span {
  51. &:nth-child(1),
  52. &:nth-child(4){
  53. opacity: 0;
  54. top: 15px;
  55. width: 0;
  56. left: 50%;
  57. }
  58. &:nth-child(2) {
  59. transform: rotate(45deg);
  60. }
  61. &:nth-child(3) {
  62. transform: rotate(-45deg);
  63. }
  64. }
  65. }
  66. }
  67. .navbar-item {
  68. margin: 0 $gap-3;
  69. }
  70. .navbar-link {
  71. color: $color-muted;
  72. padding: calc(#{$gap-2} - 2px) .75rem;
  73. transition: .3s color;
  74. position: relative;
  75. background: transparent;
  76. font: inherit;
  77. cursor: pointer;
  78. border-radius: $border-radius;
  79. text-align:left;
  80. &:hover {
  81. color: $color-text;
  82. }
  83. &:after {
  84. content: '';
  85. position: absolute;
  86. bottom: 0;
  87. left: .75rem;
  88. right: .75rem;
  89. height: 2px;
  90. border-radius: $border-radius;
  91. background: $color-primary;
  92. opacity: 0;
  93. transform: scaleX(0);
  94. transition: $transition-duration opacity, $transition-duration transform;
  95. }
  96. &.active {
  97. color: $color-primary;
  98. &:after {
  99. opacity: 1;
  100. transform: scaleX(1);
  101. }
  102. }
  103. }
  104. .navbar-btn {
  105. margin-left: $gap-3;
  106. }
  107. .navbar-dropdown {
  108. position: relative;
  109. display: flex;
  110. }
  111. .navbar-dropdown-menu {
  112. --menu-width: 25rem;
  113. position: absolute;
  114. top: calc(100% + 1rem);
  115. left: 50%;
  116. background: $color-white;
  117. width: var(--menu-width);
  118. box-shadow: $shadow-popover;
  119. border-radius: $border-radius-lg;
  120. margin-left: calc(var(--menu-width) * -.5);
  121. transition: $transition-duration opacity, $transition-duration transform, $transition-duration visibility;
  122. &:before,
  123. &:after {
  124. content: '';
  125. position: absolute;
  126. top: -.25rem;
  127. left: calc(50% - .5rem);
  128. background: inherit;
  129. transform: rotate(45deg);
  130. width: 1rem;
  131. height: 1rem;
  132. z-index: 1;
  133. }
  134. &:after {
  135. z-index: -1;
  136. box-shadow: 0 0 0 1.5px $color-border;
  137. }
  138. }
  139. .navbar-dropdown-menu-content {
  140. padding: $gap-4;
  141. display: grid;
  142. gap: $gap-4 $gap-5;
  143. //grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  144. grid-template-columns: 1fr;
  145. }
  146. .navbar-dropdown-menu-footer {
  147. padding: $gap-4;
  148. background: $color-gray;
  149. border-radius: 0 0 calc(#{$border-radius-lg} + 1px) calc(#{$border-radius-lg} + 1px)
  150. }
  151. .navbar-dropdown-menu-link {
  152. color: inherit;
  153. cursor: pointer;
  154. background: transparent;
  155. text-align: left;
  156. padding: $gap-3;
  157. margin: -$gap-3;
  158. border-radius: $border-radius;
  159. transition: $transition-duration background-color;
  160. &:hover,
  161. &:focus-visible {
  162. background: $color-gray;
  163. }
  164. }