style.ts 2.7 KB

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