ant-design/components/upload/style/dragger.ts
kiner-tang(文辉) 49ffbe2c82
feat: Upload support cssVar (#45820)
* feat: Upload support cssVar

* feat: optimize code

* Apply suggestions from code review

Signed-off-by: MadCcc <1075746765@qq.com>

* feat: update size limit

* feat: optimize code

* feat: optimize code

---------

Signed-off-by: MadCcc <1075746765@qq.com>
Signed-off-by: MadCcc <madccc@foxmail.com>
Co-authored-by: MadCcc <madccc@foxmail.com>
2023-11-13 19:44:27 +08:00

79 lines
2.1 KiB
TypeScript

import { unit } from '@ant-design/cssinjs';
import type { UploadToken } from '.';
import type { GenerateStyle } from '../../theme/internal';
const genDraggerStyle: GenerateStyle<UploadToken> = (token) => {
const { componentCls, iconCls } = token;
return {
[`${componentCls}-wrapper`]: {
[`${componentCls}-drag`]: {
position: 'relative',
width: '100%',
height: '100%',
textAlign: 'center',
background: token.colorFillAlter,
border: `${unit(token.lineWidth)} dashed ${token.colorBorder}`,
borderRadius: token.borderRadiusLG,
cursor: 'pointer',
transition: `border-color ${token.motionDurationSlow}`,
[componentCls]: {
padding: `${unit(token.padding)} 0`,
},
[`${componentCls}-btn`]: {
display: 'table',
width: '100%',
height: '100%',
outline: 'none',
},
[`${componentCls}-drag-container`]: {
display: 'table-cell',
verticalAlign: 'middle',
},
[`
&:not(${componentCls}-disabled):hover,
&-hover:not(${componentCls}-disabled)
`]: {
borderColor: token.colorPrimaryHover,
},
[`p${componentCls}-drag-icon`]: {
marginBottom: token.margin,
[iconCls]: {
color: token.colorPrimary,
fontSize: token.uploadThumbnailSize,
},
},
[`p${componentCls}-text`]: {
margin: `0 0 ${unit(token.marginXXS)}`,
color: token.colorTextHeading,
fontSize: token.fontSizeLG,
},
[`p${componentCls}-hint`]: {
color: token.colorTextDescription,
fontSize: token.fontSize,
},
// ===================== Disabled =====================
[`&${componentCls}-disabled`]: {
[`p${componentCls}-drag-icon ${iconCls},
p${componentCls}-text,
p${componentCls}-hint
`]: {
color: token.colorTextDisabled,
},
},
},
},
};
};
export default genDraggerStyle;