mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-22 22:48:29 +08:00
cbfe7fb454
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
* refactor: inline-style to cssinjs * fix: fix test case * fix: fix * Update components/upload/Upload.tsx Co-authored-by: afc163 <afc163@gmail.com> Signed-off-by: lijianan <574980606@qq.com> * rename * fix: fix --------- Signed-off-by: lijianan <574980606@qq.com> Co-authored-by: afc163 <afc163@gmail.com>
84 lines
2.3 KiB
TypeScript
84 lines
2.3 KiB
TypeScript
import { resetComponent } from '../../style';
|
|
import { genCollapseMotion } from '../../style/motion';
|
|
import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';
|
|
import { genStyleHooks, mergeToken } from '../../theme/internal';
|
|
import genDraggerStyle from './dragger';
|
|
import genListStyle from './list';
|
|
import genMotionStyle from './motion';
|
|
import { genPictureCardStyle, genPictureStyle } from './picture';
|
|
import genRtlStyle from './rtl';
|
|
|
|
export interface ComponentToken {
|
|
/**
|
|
* @desc 操作按扭颜色
|
|
* @descEN Action button color
|
|
*/
|
|
actionsColor: string;
|
|
}
|
|
|
|
export interface UploadToken extends FullToken<'Upload'> {
|
|
uploadThumbnailSize: number | string;
|
|
uploadProgressOffset: number | string;
|
|
uploadPicCardSize: number | string;
|
|
}
|
|
|
|
const genBaseStyle: GenerateStyle<UploadToken> = (token) => {
|
|
const { componentCls, colorTextDisabled } = token;
|
|
|
|
return {
|
|
[`${componentCls}-wrapper`]: {
|
|
...resetComponent(token),
|
|
|
|
[componentCls]: {
|
|
outline: 0,
|
|
"input[type='file']": {
|
|
cursor: 'pointer',
|
|
},
|
|
},
|
|
|
|
[`${componentCls}-select`]: {
|
|
display: 'inline-block',
|
|
},
|
|
|
|
[`${componentCls}-hidden`]: {
|
|
display: 'none',
|
|
},
|
|
|
|
[`${componentCls}-disabled`]: {
|
|
color: colorTextDisabled,
|
|
cursor: 'not-allowed',
|
|
},
|
|
},
|
|
};
|
|
};
|
|
|
|
export const prepareComponentToken: GetDefaultToken<'Upload'> = (token) => ({
|
|
actionsColor: token.colorTextDescription,
|
|
});
|
|
|
|
// ============================== Export ==============================
|
|
export default genStyleHooks(
|
|
'Upload',
|
|
(token) => {
|
|
const { fontSizeHeading3, fontHeight, lineWidth, controlHeightLG, calc } = token;
|
|
|
|
const uploadToken = mergeToken<UploadToken>(token, {
|
|
uploadThumbnailSize: calc(fontSizeHeading3).mul(2).equal(),
|
|
uploadProgressOffset: calc(calc(fontHeight).div(2)).add(lineWidth).equal(),
|
|
uploadPicCardSize: calc(controlHeightLG).mul(2.55).equal(),
|
|
});
|
|
|
|
return [
|
|
genBaseStyle(uploadToken),
|
|
genDraggerStyle(uploadToken),
|
|
genPictureStyle(uploadToken),
|
|
genPictureCardStyle(uploadToken),
|
|
genListStyle(uploadToken),
|
|
genMotionStyle(uploadToken),
|
|
genRtlStyle(uploadToken),
|
|
genCollapseMotion(uploadToken),
|
|
];
|
|
},
|
|
prepareComponentToken,
|
|
);
|