ant-design/components/upload/style/index.tsx
MadCcc 8e27cf986f
chore: rm component less file (#36244)
* chore: rm component less file

* refactor: less file

* refactor: rm less

* refactor: rm page-header and comment

* chore: rm less in components

* chore: update dist config

* chore: update image test

* chore: update dekko

* chore: rm lib dekko

* chore: update dist dekko

* chore: udpate bundle size

* test: update snapshot

* test: rm theme test

* test: update snapshot

* test: update snapshot

* chore: copy reset.css

* test: update image test

* chore: copy reset.css to es

* chore: update site script
2022-07-05 21:55:21 +08:00

63 lines
1.7 KiB
TypeScript

import type { FullToken, GenerateStyle } from '../../theme';
import { genComponentStyleHook, mergeToken, resetComponent } from '../../theme';
import genDraggerStyle from './dragger';
import genListStyle from './list';
import genMotionStyle from './motion';
import { genPictureCardStyle, genPictureStyle } from './picture';
import genRtlStyle from './rtl';
export interface ComponentToken {}
export interface UploadToken extends FullToken<'Upload'> {
uploadThumbnailSize: number;
uploadProgressOffset: number;
uploadPicCardSize: number;
}
const genBaseStyle: GenerateStyle<UploadToken> = token => {
const { componentCls } = token;
return {
[`${componentCls}-wrapper`]: {
...resetComponent(token),
[componentCls]: {
outline: 0,
"input[type='file']": {
cursor: 'pointer',
},
},
[`${componentCls}-select`]: {
display: 'inline-block',
},
[`${componentCls}-disabled`]: {
cursor: 'not-allowed',
},
},
};
};
// ============================== Export ==============================
export default genComponentStyleHook('Upload', token => {
const { fontSizeHeading3, fontSizeBase, lineHeight, lineWidth, controlHeightLG } = token;
const listItemHeightSM = Math.round(fontSizeBase * lineHeight);
const uploadToken = mergeToken<UploadToken>(token, {
uploadThumbnailSize: fontSizeHeading3 * 2,
uploadProgressOffset: listItemHeightSM / 2 + lineWidth,
uploadPicCardSize: controlHeightLG * 2.55,
});
return [
genBaseStyle(uploadToken),
genDraggerStyle(uploadToken),
genPictureStyle(uploadToken),
genPictureCardStyle(uploadToken),
genListStyle(uploadToken),
genMotionStyle(uploadToken),
genRtlStyle(uploadToken),
];
});