style.ts 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. import { Upload, UploadProps } from "antd";
  2. import { FC } from "react";
  3. import { css, 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. ` as FC<UploadProps>;
  23. export const AntdDragger = styled(Dragger)`
  24. ${uploadStyle}
  25. ` as FC<UploadProps>;
  26. export const AntdDraggerText = styled.p`
  27. margin: 14px 0;
  28. `;
  29. export const UploadFileItem = styled.div`
  30. margin-top: 8px;
  31. display: flex;
  32. align-items: center;
  33. height: 24px;
  34. overflow: hidden;
  35. border-radius: 4px;
  36. transition: all 0.3s;
  37. &:hover {
  38. background-color: rgba(0, 0, 0, 0.04);
  39. }
  40. .ant-upload-list-item {
  41. flex: 1;
  42. width: 0;
  43. height: 100% !important;
  44. margin: 0 !important;
  45. overflow: hidden;
  46. white-space: nowrap;
  47. text-overflow: ellipsis;
  48. &:hover {
  49. background: none !important;
  50. }
  51. }
  52. `;
  53. export const UploadFileItemActions = styled.div`
  54. display: none;
  55. white-space: nowrap;
  56. ${UploadFileItem}:hover & {
  57. display: block;
  58. }
  59. .ant-btn {
  60. color: #666;
  61. }
  62. `;
  63. export const UploadPictureItem = styled.div`
  64. position: relative;
  65. height: 100%;
  66. &:hover::before {
  67. opacity: 1;
  68. }
  69. &::before {
  70. position: absolute;
  71. top: 8px;
  72. left: 8px;
  73. z-index: 1;
  74. width: calc(100% - 16px);
  75. height: calc(100% - 16px);
  76. background-color: rgba(0, 0, 0, 0.45);
  77. opacity: 0;
  78. transition: all 0.3s;
  79. content: " ";
  80. }
  81. .ant-upload-list-item::before {
  82. display: none;
  83. }
  84. `;
  85. export const UploadPictureItemActions = styled.div`
  86. display: none;
  87. position: absolute;
  88. top: 50%;
  89. left: 50%;
  90. white-space: nowrap;
  91. transform: translate(-50%, -50%);
  92. z-index: 2;
  93. ${UploadPictureItem}:hover & {
  94. display: block;
  95. }
  96. .ant-btn {
  97. color: rgba(255, 255, 255, 0.65);
  98. &:hover {
  99. color: white !important;
  100. }
  101. }
  102. `;