drawer.less 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. @import '../../style/themes/index';
  2. @drawer-prefix-cls: ~'@{ant-prefix}-drawer';
  3. @picker-prefix-cls: ~'@{ant-prefix}-picker';
  4. @drawer-animation-ease: @ease-out-quint;
  5. .@{drawer-prefix-cls} {
  6. @drawer-header-close-padding: ceil(((@drawer-header-close-size - @font-size-lg) / 2));
  7. position: fixed;
  8. z-index: @zindex-modal;
  9. width: 0%;
  10. height: 100%;
  11. transition: width 0s ease @animation-duration-slow, height 0s ease @animation-duration-slow;
  12. &-content-wrapper {
  13. position: absolute;
  14. width: 100%;
  15. height: 100%;
  16. transition: transform @animation-duration-slow @drawer-animation-ease,
  17. box-shadow @animation-duration-slow @drawer-animation-ease;
  18. }
  19. .@{drawer-prefix-cls}-content {
  20. width: 100%;
  21. height: 100%;
  22. }
  23. &-left,
  24. &-right {
  25. top: 0;
  26. width: 0%;
  27. height: 100%;
  28. .@{drawer-prefix-cls}-content-wrapper {
  29. height: 100%;
  30. }
  31. &.@{drawer-prefix-cls}-open {
  32. width: 100%;
  33. transition: transform @animation-duration-slow @drawer-animation-ease;
  34. }
  35. }
  36. &-left {
  37. left: 0;
  38. .@{drawer-prefix-cls} {
  39. &-content-wrapper {
  40. left: 0;
  41. }
  42. }
  43. &.@{drawer-prefix-cls}-open {
  44. .@{drawer-prefix-cls}-content-wrapper {
  45. box-shadow: @shadow-1-right;
  46. }
  47. }
  48. }
  49. &-right {
  50. right: 0;
  51. .@{drawer-prefix-cls} {
  52. &-content-wrapper {
  53. right: 0;
  54. }
  55. }
  56. &.@{drawer-prefix-cls}-open {
  57. .@{drawer-prefix-cls}-content-wrapper {
  58. box-shadow: @shadow-1-left;
  59. }
  60. // https://github.com/ant-design/ant-design/issues/18607, Avoid edge alignment bug.
  61. &.no-mask {
  62. right: 1px;
  63. transform: translateX(1px);
  64. }
  65. }
  66. }
  67. &-top,
  68. &-bottom {
  69. left: 0;
  70. width: 100%;
  71. height: 0%;
  72. .@{drawer-prefix-cls}-content-wrapper {
  73. width: 100%;
  74. }
  75. &.@{drawer-prefix-cls}-open {
  76. height: 100%;
  77. transition: transform @animation-duration-slow @drawer-animation-ease;
  78. }
  79. }
  80. &-top {
  81. top: 0;
  82. &.@{drawer-prefix-cls}-open {
  83. .@{drawer-prefix-cls}-content-wrapper {
  84. box-shadow: @shadow-1-down;
  85. }
  86. }
  87. }
  88. &-bottom {
  89. bottom: 0;
  90. .@{drawer-prefix-cls} {
  91. &-content-wrapper {
  92. bottom: 0;
  93. }
  94. }
  95. &.@{drawer-prefix-cls}-open {
  96. .@{drawer-prefix-cls}-content-wrapper {
  97. box-shadow: @shadow-1-up;
  98. }
  99. &.no-mask {
  100. bottom: 1px;
  101. transform: translateY(1px);
  102. }
  103. }
  104. }
  105. &.@{drawer-prefix-cls}-open .@{drawer-prefix-cls}-mask {
  106. height: 100%;
  107. opacity: 1;
  108. transition: none;
  109. animation: antdDrawerFadeIn @animation-duration-slow @drawer-animation-ease;
  110. pointer-events: auto;
  111. }
  112. &-title {
  113. flex: 1;
  114. margin: 0;
  115. color: @heading-color;
  116. font-weight: 500;
  117. font-size: @drawer-title-font-size;
  118. line-height: @drawer-title-line-height;
  119. }
  120. &-content {
  121. position: relative;
  122. z-index: 1;
  123. overflow: auto;
  124. background-color: @drawer-bg;
  125. background-clip: padding-box;
  126. border: 0;
  127. }
  128. &-close {
  129. display: inline-block;
  130. margin-right: 12px;
  131. color: @modal-close-color;
  132. font-weight: 700;
  133. font-size: @font-size-lg;
  134. font-style: normal;
  135. line-height: 1;
  136. text-align: center;
  137. text-transform: none;
  138. text-decoration: none;
  139. background: transparent;
  140. border: 0;
  141. outline: 0;
  142. cursor: pointer;
  143. transition: color @animation-duration-slow;
  144. text-rendering: auto;
  145. &:focus,
  146. &:hover {
  147. color: @icon-color-hover;
  148. text-decoration: none;
  149. }
  150. }
  151. &-header {
  152. position: relative;
  153. display: flex;
  154. align-items: center;
  155. justify-content: space-between;
  156. padding: @drawer-header-padding;
  157. color: @text-color;
  158. background: @drawer-bg;
  159. border-bottom: @border-width-base @border-style-base @border-color-split;
  160. border-radius: @border-radius-base @border-radius-base 0 0;
  161. &-title {
  162. display: flex;
  163. flex: 1;
  164. align-items: center;
  165. justify-content: space-between;
  166. }
  167. &-close-only {
  168. padding-bottom: 0;
  169. border: none;
  170. }
  171. }
  172. &-wrapper-body {
  173. display: flex;
  174. flex-flow: column nowrap;
  175. width: 100%;
  176. height: 100%;
  177. }
  178. &-body {
  179. flex-grow: 1;
  180. padding: @drawer-body-padding;
  181. overflow: auto;
  182. font-size: @font-size-base;
  183. line-height: @line-height-base;
  184. word-wrap: break-word;
  185. }
  186. &-footer {
  187. flex-shrink: 0;
  188. padding: @drawer-footer-padding-vertical @drawer-footer-padding-horizontal;
  189. border-top: @border-width-base @border-style-base @border-color-split;
  190. }
  191. &-mask {
  192. position: absolute;
  193. top: 0;
  194. left: 0;
  195. width: 100%;
  196. height: 0;
  197. background-color: @modal-mask-bg;
  198. opacity: 0;
  199. transition: opacity @animation-duration-slow linear, height 0s ease @animation-duration-slow;
  200. pointer-events: none;
  201. }
  202. // =================== Hook Components ===================
  203. .@{picker-prefix-cls} {
  204. &-clear {
  205. background: @popover-background;
  206. }
  207. }
  208. }
  209. @keyframes antdDrawerFadeIn {
  210. 0% {
  211. opacity: 0;
  212. }
  213. 100% {
  214. opacity: 1;
  215. }
  216. }