2023-11-13 19:44:27 +08:00
|
|
|
import { unit } from '@ant-design/cssinjs';
|
2024-04-08 14:04:08 +08:00
|
|
|
|
2022-05-19 10:06:58 +08:00
|
|
|
import type { UploadToken } from '.';
|
2022-11-23 20:22:38 +08:00
|
|
|
import type { GenerateStyle } from '../../theme/internal';
|
2022-04-25 18:46:53 +08:00
|
|
|
|
2022-11-19 13:47:33 +08:00
|
|
|
const genDraggerStyle: GenerateStyle<UploadToken> = (token) => {
|
2022-04-25 18:46:53 +08:00
|
|
|
const { componentCls, iconCls } = token;
|
|
|
|
|
|
|
|
return {
|
|
|
|
[`${componentCls}-wrapper`]: {
|
|
|
|
[`${componentCls}-drag`]: {
|
|
|
|
position: 'relative',
|
|
|
|
width: '100%',
|
|
|
|
height: '100%',
|
|
|
|
textAlign: 'center',
|
2022-07-21 17:00:42 +08:00
|
|
|
background: token.colorFillAlter,
|
2023-11-13 19:44:27 +08:00
|
|
|
border: `${unit(token.lineWidth)} dashed ${token.colorBorder}`,
|
2022-11-01 15:06:38 +08:00
|
|
|
borderRadius: token.borderRadiusLG,
|
2022-04-25 18:46:53 +08:00
|
|
|
cursor: 'pointer',
|
|
|
|
transition: `border-color ${token.motionDurationSlow}`,
|
|
|
|
|
|
|
|
[componentCls]: {
|
2023-12-14 19:20:46 +08:00
|
|
|
padding: token.padding,
|
2022-04-25 18:46:53 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-btn`]: {
|
2024-01-05 14:22:45 +08:00
|
|
|
display: 'table',
|
|
|
|
width: '100%',
|
|
|
|
height: '100%',
|
2022-04-25 18:46:53 +08:00
|
|
|
outline: 'none',
|
2023-12-30 15:21:52 +08:00
|
|
|
borderRadius: token.borderRadiusLG,
|
|
|
|
|
2024-01-05 14:22:45 +08:00
|
|
|
'&:focus-visible': {
|
2023-12-30 15:21:52 +08:00
|
|
|
outline: `${unit(token.lineWidthFocus)} solid ${token.colorPrimaryBorder}`,
|
|
|
|
},
|
2022-04-25 18:46:53 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-drag-container`]: {
|
|
|
|
display: 'table-cell',
|
|
|
|
verticalAlign: 'middle',
|
|
|
|
},
|
|
|
|
|
2023-11-03 19:00:11 +08:00
|
|
|
[`
|
|
|
|
&:not(${componentCls}-disabled):hover,
|
|
|
|
&-hover:not(${componentCls}-disabled)
|
|
|
|
`]: {
|
2022-04-25 18:46:53 +08:00
|
|
|
borderColor: token.colorPrimaryHover,
|
|
|
|
},
|
|
|
|
|
|
|
|
[`p${componentCls}-drag-icon`]: {
|
2022-05-19 10:06:58 +08:00
|
|
|
marginBottom: token.margin,
|
2022-04-25 18:46:53 +08:00
|
|
|
|
|
|
|
[iconCls]: {
|
|
|
|
color: token.colorPrimary,
|
2022-05-19 10:06:58 +08:00
|
|
|
fontSize: token.uploadThumbnailSize,
|
2022-04-25 18:46:53 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`p${componentCls}-text`]: {
|
2023-11-13 19:44:27 +08:00
|
|
|
margin: `0 0 ${unit(token.marginXXS)}`,
|
2022-04-25 18:46:53 +08:00
|
|
|
color: token.colorTextHeading,
|
|
|
|
fontSize: token.fontSizeLG,
|
|
|
|
},
|
|
|
|
|
|
|
|
[`p${componentCls}-hint`]: {
|
2022-08-04 16:16:50 +08:00
|
|
|
color: token.colorTextDescription,
|
2022-11-01 15:06:38 +08:00
|
|
|
fontSize: token.fontSize,
|
2022-04-25 18:46:53 +08:00
|
|
|
},
|
2022-05-19 10:06:58 +08:00
|
|
|
|
|
|
|
// ===================== Disabled =====================
|
|
|
|
[`&${componentCls}-disabled`]: {
|
|
|
|
[`p${componentCls}-drag-icon ${iconCls},
|
|
|
|
p${componentCls}-text,
|
|
|
|
p${componentCls}-hint
|
|
|
|
`]: {
|
|
|
|
color: token.colorTextDisabled,
|
|
|
|
},
|
|
|
|
},
|
2022-04-25 18:46:53 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export default genDraggerStyle;
|