Skip to content

Commit

Permalink
🐛 fix: fileUpload use theme color
Browse files Browse the repository at this point in the history
  • Loading branch information
eternallycyf committed Dec 14, 2024
1 parent cfb18fe commit f0dfb8f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 10 deletions.
17 changes: 9 additions & 8 deletions packages/ims-view-pc/src/components/FileUpload/Detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
LoadingOutlined,
} from '@ant-design/icons';
import { Col, Progress, Row, Space, Spin, Tooltip } from 'antd';
import { AccessBtn, CustomTooltip, variables } from 'ims-view-pc';
import { AccessBtn, CustomTooltip } from 'ims-view-pc';
import { FC } from 'react';
import FileImage from './FileImage';
import './index.less';
Expand All @@ -21,8 +21,6 @@ import {
isImg,
} from './utils';

const FileView = () => <div>FileView</div>;

const Detail: FC<FileUploadDetailProps> = (props) => {
const {
isDetail,
Expand Down Expand Up @@ -88,10 +86,10 @@ const Detail: FC<FileUploadDetailProps> = (props) => {
return (
<span>
<span className="success">
<CheckCircleFilled style={{ color: variables.colorSuccess }} />
<CheckCircleFilled className="success-color" />
</span>
<span className="delete" onClick={() => handleDelete(item)}>
<DeleteOutlined style={{ color: variables.colorError }} />
<DeleteOutlined className="error-color" />
</span>
</span>
);
Expand All @@ -118,7 +116,10 @@ const Detail: FC<FileUploadDetailProps> = (props) => {
<Tooltip title="查看">
<EyeOutlined
onClick={() => handlePreview(item)}
style={{ color: variables.colorInfo, cursor: 'pointer' }}
className="primary-color"
style={{
cursor: 'pointer',
}}
/>
</Tooltip>
),
Expand All @@ -130,7 +131,7 @@ const Detail: FC<FileUploadDetailProps> = (props) => {
) : (
<Tooltip title="替换">
<DiffOutlined
style={{ color: variables.colorInfo }}
className="primary-color"
onClick={() => handleReplace(index)}
/>
</Tooltip>
Expand All @@ -142,7 +143,7 @@ const Detail: FC<FileUploadDetailProps> = (props) => {
element: (
<Tooltip title="下载">
<DownloadOutlined
style={{ color: variables.colorInfo }}
className="primary-color"
onClick={() => handleDownload(item)}
/>
</Tooltip>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,14 @@ const FileUpload: React.FC<FileUploadProps> = (props) => {
if (isDetail) return <Detail {...detailProps} />;

return (
<div className="FileUpload" style={{ '--colorPrimary': variables?.colorPrimary }}>
<div
className="FileUpload"
style={{
'--colorPrimary': variables?.colorPrimary,
'--colorSuccess': variables?.colorSuccess,
'--colorError': variables?.colorError,
}}
>
<div className="uploadContent" style={{ marginTop: fileList?.length != 0 ? 10 : 0 }}>
{(config?.extra || config?.label) && (
<Form.Item className="header" layout="horizontal" {...defaultHeaderFormItemProps}>
Expand Down
14 changes: 13 additions & 1 deletion packages/ims-view-pc/src/components/FileUpload/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,20 @@
line-height: 0;

.ant-progress-bg {
background-color: var(--colorPrimary);
background: var(--ant-color-primary, var(--colorPrimary));
}
}
}

.primary-color {
color: var(--ant-color-primary, var(--colorPrimary));
}

.success-color {
color: var(--ant-color-success, var(--colorSuccess));
}

.error-color {
color: var(--ant-color-error, var(--colorError));
}
}

0 comments on commit f0dfb8f

Please sign in to comment.