amis-rpc-design/node_modules/antd/lib/back-top/style/index.js

91 lines
2.6 KiB
JavaScript
Raw Normal View History

2023-10-07 19:42:30 +08:00
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _internal = require("../../theme/internal");
var _style = require("../../style");
// ============================== Shared ==============================
const genSharedBackTopStyle = token => {
const {
componentCls,
backTopFontSize,
backTopSize,
zIndexPopup
} = token;
return {
[componentCls]: Object.assign(Object.assign({}, (0, _style.resetComponent)(token)), {
position: 'fixed',
insetInlineEnd: token.backTopInlineEnd,
insetBlockEnd: token.backTopBlockEnd,
zIndex: zIndexPopup,
width: 40,
height: 40,
cursor: 'pointer',
'&:empty': {
display: 'none'
},
[`${componentCls}-content`]: {
width: backTopSize,
height: backTopSize,
overflow: 'hidden',
color: token.backTopColor,
textAlign: 'center',
backgroundColor: token.backTopBackground,
borderRadius: backTopSize,
transition: `all ${token.motionDurationMid}`,
'&:hover': {
backgroundColor: token.backTopHoverBackground,
transition: `all ${token.motionDurationMid}`
}
},
// change to .backtop .backtop-icon
[`${componentCls}-icon`]: {
fontSize: backTopFontSize,
lineHeight: `${backTopSize}px`
}
})
};
};
const genMediaBackTopStyle = token => {
const {
componentCls
} = token;
return {
[`@media (max-width: ${token.screenMD}px)`]: {
[componentCls]: {
insetInlineEnd: token.backTopInlineEndMD
}
},
[`@media (max-width: ${token.screenXS}px)`]: {
[componentCls]: {
insetInlineEnd: token.backTopInlineEndXS
}
}
};
};
// ============================== Export ==============================
var _default = exports.default = (0, _internal.genComponentStyleHook)('BackTop', token => {
const {
fontSizeHeading3,
colorTextDescription,
colorTextLightSolid,
colorText,
controlHeightLG
} = token;
const backTopToken = (0, _internal.mergeToken)(token, {
backTopBackground: colorTextDescription,
backTopColor: colorTextLightSolid,
backTopHoverBackground: colorText,
backTopFontSize: fontSizeHeading3,
backTopSize: controlHeightLG,
backTopBlockEnd: controlHeightLG * 1.25,
backTopInlineEnd: controlHeightLG * 2.5,
backTopInlineEndMD: controlHeightLG * 1.5,
backTopInlineEndXS: controlHeightLG * 0.5
});
return [genSharedBackTopStyle(backTopToken), genMediaBackTopStyle(backTopToken)];
}, token => ({
zIndexPopup: token.zIndexBase + 10
}));