mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-16 01:41:02 +08:00
66 lines
1.9 KiB
TypeScript
66 lines
1.9 KiB
TypeScript
import { resetComponent } from '../../style';
|
|
import type { FullToken, GenerateStyle } from '../../theme/internal';
|
|
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
|
|
|
export interface ComponentToken {}
|
|
|
|
interface QRCodeToken extends FullToken<'QRCode'> {
|
|
QRCodeExpiredTextColor: string;
|
|
QRCodeMaskBackgroundColor: string;
|
|
}
|
|
|
|
const genQRCodeStyle: GenerateStyle<QRCodeToken> = (token) => {
|
|
const { componentCls } = token;
|
|
return {
|
|
[componentCls]: {
|
|
...resetComponent(token),
|
|
display: 'flex',
|
|
justifyContent: 'center',
|
|
alignItems: 'center',
|
|
padding: token.paddingSM,
|
|
backgroundColor: token.colorWhite,
|
|
borderRadius: token.borderRadiusLG,
|
|
border: `${token.lineWidth}px ${token.lineType} ${token.colorSplit}`,
|
|
position: 'relative',
|
|
width: '100%',
|
|
height: '100%',
|
|
overflow: 'hidden',
|
|
[`& > ${componentCls}-mask`]: {
|
|
position: 'absolute',
|
|
insetBlockStart: 0,
|
|
insetInlineStart: 0,
|
|
zIndex: 10,
|
|
display: 'flex',
|
|
flexDirection: 'column',
|
|
justifyContent: 'center',
|
|
alignItems: 'center',
|
|
width: '100%',
|
|
height: '100%',
|
|
color: token.colorText,
|
|
lineHeight: token.lineHeight,
|
|
background: token.QRCodeMaskBackgroundColor,
|
|
textAlign: 'center',
|
|
[`& > ${componentCls}-expired`]: {
|
|
color: token.QRCodeExpiredTextColor,
|
|
},
|
|
},
|
|
'&-icon': {
|
|
marginBlockEnd: token.marginXS,
|
|
fontSize: token.controlHeight,
|
|
},
|
|
},
|
|
[`${componentCls}-borderless`]: {
|
|
borderColor: 'transparent',
|
|
},
|
|
};
|
|
};
|
|
|
|
export default genComponentStyleHook<'QRCode'>('QRCode', (token) =>
|
|
genQRCodeStyle(
|
|
mergeToken<QRCodeToken>(token, {
|
|
QRCodeExpiredTextColor: 'rgba(0, 0, 0, 0.88)',
|
|
QRCodeMaskBackgroundColor: 'rgba(255, 255, 255, 0.96)',
|
|
}),
|
|
),
|
|
);
|