You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
130 lines
3.4 KiB
130 lines
3.4 KiB
3 years ago
|
import type { UploadToken } from '.';
|
||
2 years ago
|
import type { GenerateStyle } from '../../theme/internal';
|
||
2 years ago
|
import { clearFix, textEllipsis } from '../../style';
|
||
3 years ago
|
|
||
2 years ago
|
const genListStyle: GenerateStyle<UploadToken> = (token) => {
|
||
2 years ago
|
const { componentCls, antCls, iconCls, fontSize, lineHeight } = token;
|
||
3 years ago
|
const itemCls = `${componentCls}-list-item`;
|
||
|
const actionsCls = `${itemCls}-actions`;
|
||
|
const actionCls = `${itemCls}-action`;
|
||
2 years ago
|
const listItemHeightSM = Math.round(fontSize * lineHeight);
|
||
3 years ago
|
|
||
|
return {
|
||
|
[`${componentCls}-wrapper`]: {
|
||
|
[`${componentCls}-list`]: {
|
||
|
...clearFix(),
|
||
|
lineHeight: token.lineHeight,
|
||
|
|
||
|
[itemCls]: {
|
||
|
position: 'relative',
|
||
2 years ago
|
height: token.lineHeight * fontSize,
|
||
3 years ago
|
marginTop: token.marginXS,
|
||
2 years ago
|
fontSize,
|
||
3 years ago
|
display: 'flex',
|
||
|
alignItems: 'center',
|
||
|
transition: `background-color ${token.motionDurationSlow}`,
|
||
|
|
||
|
'&:hover': {
|
||
|
backgroundColor: token.controlItemBgHover,
|
||
|
},
|
||
|
|
||
|
[`${itemCls}-name`]: {
|
||
2 years ago
|
...textEllipsis,
|
||
3 years ago
|
padding: `0 ${token.paddingXS}px`,
|
||
3 years ago
|
lineHeight,
|
||
3 years ago
|
flex: 'auto',
|
||
|
transition: `all ${token.motionDurationSlow}`,
|
||
|
},
|
||
|
|
||
|
[actionsCls]: {
|
||
|
[actionCls]: {
|
||
|
opacity: 0,
|
||
|
},
|
||
|
|
||
|
[`${actionCls}${antCls}-btn-sm`]: {
|
||
3 years ago
|
height: listItemHeightSM,
|
||
|
border: 0,
|
||
3 years ago
|
lineHeight: 1,
|
||
|
// FIXME: should not override small button
|
||
|
'> span': {
|
||
|
transform: 'scale(1)',
|
||
|
},
|
||
|
},
|
||
|
|
||
|
[`
|
||
|
${actionCls}:focus,
|
||
|
&.picture ${actionCls}
|
||
|
`]: {
|
||
|
opacity: 1,
|
||
|
},
|
||
|
|
||
|
[iconCls]: {
|
||
2 years ago
|
color: token.colorTextDescription,
|
||
3 years ago
|
transition: `all ${token.motionDurationSlow}`,
|
||
|
},
|
||
|
|
||
|
[`&:hover ${iconCls}`]: {
|
||
|
color: token.colorText,
|
||
|
},
|
||
|
},
|
||
|
|
||
|
[`${componentCls}-icon ${iconCls}`]: {
|
||
2 years ago
|
color: token.colorTextDescription,
|
||
2 years ago
|
fontSize,
|
||
3 years ago
|
},
|
||
|
|
||
|
[`${itemCls}-progress`]: {
|
||
|
position: 'absolute',
|
||
3 years ago
|
bottom: -token.uploadProgressOffset,
|
||
3 years ago
|
width: '100%',
|
||
2 years ago
|
paddingInlineStart: fontSize + token.paddingXS,
|
||
|
fontSize,
|
||
3 years ago
|
lineHeight: 0,
|
||
3 years ago
|
pointerEvents: 'none',
|
||
|
|
||
|
'> div': {
|
||
|
margin: 0,
|
||
|
},
|
||
3 years ago
|
},
|
||
|
},
|
||
|
|
||
|
[`${itemCls}:hover ${actionCls}`]: {
|
||
|
opacity: 1,
|
||
|
color: token.colorText,
|
||
|
},
|
||
|
|
||
|
[`${itemCls}-error`]: {
|
||
|
color: token.colorError,
|
||
|
[`${itemCls}-name, ${componentCls}-icon ${iconCls}`]: {
|
||
|
color: token.colorError,
|
||
|
},
|
||
|
|
||
|
[actionsCls]: {
|
||
|
[`${iconCls}, ${iconCls}:hover`]: {
|
||
|
color: token.colorError,
|
||
|
},
|
||
|
|
||
|
[actionCls]: {
|
||
|
opacity: 1,
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
|
||
|
[`${componentCls}-list-item-container`]: {
|
||
|
transition: `opacity ${token.motionDurationSlow}, height ${token.motionDurationSlow}`,
|
||
|
|
||
|
// For smooth removing animation
|
||
|
'&::before': {
|
||
|
display: 'table',
|
||
|
width: 0,
|
||
|
height: 0,
|
||
|
content: '""',
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
};
|
||
|
};
|
||
|
|
||
|
export default genListStyle;
|