style.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. import { CloseOutlined } from "@ant-design/icons";
  2. import { Upload } from "antd";
  3. import { css, keyframes, styled } from "styled-components";
  4. const { Dragger } = Upload;
  5. export const UploadTips = styled.p `
  6. color: #999999;
  7. font-size: 12px;
  8. `;
  9. export const UploadContainer = styled.div.attrs({
  10. className: "dage-upload",
  11. }) `
  12. display: inline-block;
  13. min-width: 320px;
  14. `;
  15. const uploadStyle = css `
  16. .ant-btn:has(.hide) {
  17. display: none;
  18. }
  19. `;
  20. export const AntdUpload = styled(Upload) `
  21. ${uploadStyle}
  22. `;
  23. export const AntdDragger = styled(Dragger) `
  24. ${uploadStyle}
  25. `;
  26. export const AntdDraggerText = styled.p `
  27. margin: 14px 0;
  28. `;
  29. export const UploadFileItem = styled.div `
  30. display: flex;
  31. align-items: center;
  32. position: relative;
  33. margin-top: 8px;
  34. height: 24px;
  35. border-radius: 4px;
  36. transition: all 0.3s;
  37. &:hover {
  38. background-color: rgba(0, 0, 0, 0.04);
  39. }
  40. ${({ $showDownloadProgress }) => $showDownloadProgress &&
  41. css `
  42. margin-bottom: 10px;
  43. `}
  44. .ant-upload-list-item {
  45. flex: 1;
  46. width: 0;
  47. height: 100% !important;
  48. margin: 0 !important;
  49. overflow: hidden;
  50. white-space: nowrap;
  51. text-overflow: ellipsis;
  52. &:hover {
  53. background: none !important;
  54. }
  55. }
  56. `;
  57. export const UploadFileItemActions = styled.div `
  58. display: none;
  59. white-space: nowrap;
  60. ${UploadFileItem}:hover & {
  61. display: block;
  62. }
  63. .ant-btn {
  64. color: #666;
  65. }
  66. `;
  67. export const UploadPictureItem = styled.div `
  68. position: relative;
  69. height: 100%;
  70. &:hover::before {
  71. opacity: 1;
  72. }
  73. &::before {
  74. position: absolute;
  75. top: 8px;
  76. left: 8px;
  77. z-index: 1;
  78. width: calc(100% - 16px);
  79. height: calc(100% - 16px);
  80. background-color: rgba(0, 0, 0, 0.45);
  81. opacity: 0;
  82. transition: all 0.3s;
  83. content: " ";
  84. }
  85. .ant-upload-list-item::before {
  86. display: none;
  87. }
  88. `;
  89. export const UploadPictureItemActions = styled.div `
  90. display: none;
  91. position: absolute;
  92. top: 50%;
  93. left: 50%;
  94. white-space: nowrap;
  95. transform: translate(-50%, -50%);
  96. z-index: 2;
  97. ${UploadPictureItem}:hover & {
  98. display: block;
  99. }
  100. .ant-btn {
  101. color: rgba(255, 255, 255, 0.65);
  102. &:hover {
  103. color: white !important;
  104. }
  105. }
  106. `;
  107. const fadeInAnimation = keyframes `
  108. 0% { opacity: 0; }
  109. 100% { opacity: 1; }
  110. `;
  111. export const DownloadProgress = styled.div `
  112. display: flex;
  113. align-items: center;
  114. position: absolute;
  115. left: 0;
  116. right: 0;
  117. bottom: -15px;
  118. animation: ${fadeInAnimation} 0.2s ease-in-out;
  119. `;
  120. export const DownloadCancelBtn = styled(CloseOutlined) `
  121. position: relative;
  122. top: 2px;
  123. margin-left: 5px;
  124. color: #999;
  125. cursor: pointer;
  126. `;