drawer.scss 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. @use 'mixins/mixins' as *;
  2. @use 'mixins/var' as *;
  3. @use 'common/var' as *;
  4. $directions: rtl, ltr, ttb, btt;
  5. @include b(drawer) {
  6. @include set-component-css-var('drawer', $drawer);
  7. }
  8. @include b(drawer) {
  9. position: absolute;
  10. box-sizing: border-box;
  11. background-color: getCssVar('drawer', 'bg-color');
  12. display: flex;
  13. flex-direction: column;
  14. box-shadow: getCssVar('box-shadow', 'dark');
  15. overflow: hidden;
  16. transition: all getCssVar('transition-duration');
  17. @each $direction in $directions {
  18. .#{$direction} {
  19. transform: translate(0, 0);
  20. }
  21. }
  22. &__sr-focus:focus {
  23. outline: none !important;
  24. }
  25. &__header {
  26. align-items: center;
  27. color: rgb(114, 118, 123);
  28. display: flex;
  29. margin-bottom: 32px;
  30. padding: getCssVar('drawer-padding-primary');
  31. padding-bottom: 0;
  32. & > :first-child {
  33. flex: 1;
  34. }
  35. }
  36. &__title {
  37. margin: 0;
  38. flex: 1;
  39. line-height: inherit;
  40. font-size: 1rem;
  41. }
  42. @include e(footer) {
  43. padding: getCssVar('drawer-padding-primary');
  44. padding-top: 10px;
  45. text-align: right;
  46. }
  47. &__close-btn {
  48. display: inline-flex;
  49. border: none;
  50. cursor: pointer;
  51. font-size: getCssVar('font-size-extra-large');
  52. color: inherit;
  53. background-color: transparent;
  54. outline: none;
  55. &:focus,
  56. &:hover {
  57. i {
  58. color: getCssVar('color-primary');
  59. }
  60. }
  61. }
  62. &__body {
  63. flex: 1;
  64. padding: getCssVar('drawer-padding-primary');
  65. overflow: auto;
  66. & > * {
  67. box-sizing: border-box;
  68. }
  69. }
  70. &.ltr,
  71. &.rtl {
  72. height: 100%;
  73. top: 0;
  74. bottom: 0;
  75. }
  76. &.ttb,
  77. &.btt {
  78. width: 100%;
  79. left: 0;
  80. right: 0;
  81. }
  82. &.ltr {
  83. left: 0;
  84. }
  85. &.rtl {
  86. right: 0;
  87. }
  88. &.ttb {
  89. top: 0;
  90. }
  91. &.btt {
  92. bottom: 0;
  93. }
  94. }
  95. .#{$namespace}-drawer-fade {
  96. &-enter-active,
  97. &-leave-active {
  98. transition: all getCssVar('transition-duration');
  99. }
  100. &-enter-from,
  101. &-enter-active,
  102. &-enter-to,
  103. &-leave-from,
  104. &-leave-active,
  105. &-leave-to {
  106. overflow: hidden !important;
  107. }
  108. &-enter-from,
  109. &-leave-to {
  110. opacity: 0;
  111. }
  112. &-enter-to,
  113. &-leave-from {
  114. opacity: 1;
  115. }
  116. &-enter-from,
  117. &-leave-to {
  118. @each $direction in $directions {
  119. .#{$direction} {
  120. @if $direction == ltr {
  121. transform: translateX(-100%);
  122. }
  123. @if $direction == rtl {
  124. transform: translateX(100%);
  125. }
  126. @if $direction == ttb {
  127. transform: translateY(-100%);
  128. }
  129. @if $direction == btt {
  130. transform: translateY(100%);
  131. }
  132. }
  133. }
  134. }
  135. }