ant-design/components/upload/style/list.ts
afc163 e34a6a8c6f
Some checks are pending
Publish Any Commit / build (push) Waiting to run
🔀 Sync mirror to Gitee / mirror (push) Waiting to run
✅ test / lint (push) Waiting to run
✅ test / test-react-legacy (16, 1/2) (push) Waiting to run
✅ test / test-react-legacy (16, 2/2) (push) Waiting to run
✅ test / test-react-legacy (17, 1/2) (push) Waiting to run
✅ test / test-react-legacy (17, 2/2) (push) Waiting to run
✅ test / test-node (push) Waiting to run
✅ test / test-react-latest (dom, 1/2) (push) Waiting to run
✅ test / test-react-latest (dom, 2/2) (push) Waiting to run
✅ test / test-react-latest-dist (dist, 1/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist, 2/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist-min, 1/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist-min, 2/2) (push) Blocked by required conditions
✅ test / test-coverage (push) Blocked by required conditions
✅ test / build (push) Waiting to run
✅ test / test lib/es module (es, 1/2) (push) Waiting to run
✅ test / test lib/es module (es, 2/2) (push) Waiting to run
✅ test / test lib/es module (lib, 1/2) (push) Waiting to run
✅ test / test lib/es module (lib, 2/2) (push) Waiting to run
👁️ Visual Regression Persist Start / test image (push) Waiting to run
fix: Button custom icon is not align center (#51652)
2024-11-18 12:03:52 +08:00

119 lines
3.1 KiB
TypeScript

import { unit } from '@ant-design/cssinjs';
import type { UploadToken } from '.';
import { clearFix, textEllipsis } from '../../style';
import type { GenerateStyle } from '../../theme/internal';
const genListStyle: GenerateStyle<UploadToken> = (token) => {
const { componentCls, iconCls, fontSize, lineHeight, calc } = token;
const itemCls = `${componentCls}-list-item`;
const actionsCls = `${itemCls}-actions`;
const actionCls = `${itemCls}-action`;
return {
[`${componentCls}-wrapper`]: {
[`${componentCls}-list`]: {
...clearFix(),
lineHeight: token.lineHeight,
[itemCls]: {
position: 'relative',
height: calc(token.lineHeight).mul(fontSize).equal(),
marginTop: token.marginXS,
fontSize,
display: 'flex',
alignItems: 'center',
transition: `background-color ${token.motionDurationSlow}`,
borderRadius: token.borderRadiusSM,
'&:hover': {
backgroundColor: token.controlItemBgHover,
},
[`${itemCls}-name`]: {
...textEllipsis,
padding: `0 ${unit(token.paddingXS)}`,
lineHeight,
flex: 'auto',
transition: `all ${token.motionDurationSlow}`,
},
[actionsCls]: {
whiteSpace: 'nowrap',
[actionCls]: {
opacity: 0,
},
[iconCls]: {
color: token.actionsColor,
transition: `all ${token.motionDurationSlow}`,
},
[`
${actionCls}:focus-visible,
&.picture ${actionCls}
`]: {
opacity: 1,
},
},
[`${componentCls}-icon ${iconCls}`]: {
color: token.colorTextDescription,
fontSize,
},
[`${itemCls}-progress`]: {
position: 'absolute',
bottom: token.calc(token.uploadProgressOffset).mul(-1).equal(),
width: '100%',
paddingInlineStart: calc(fontSize).add(token.paddingXS).equal(),
fontSize,
lineHeight: 0,
pointerEvents: 'none',
'> div': {
margin: 0,
},
},
},
[`${itemCls}:hover ${actionCls}`]: {
opacity: 1,
},
[`${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;