2022-05-09 22:20:07 +08:00
|
|
|
import type { CSSObject } from '@ant-design/cssinjs';
|
2022-06-27 14:25:59 +08:00
|
|
|
import type { FullToken, GenerateStyle } from '../../theme';
|
|
|
|
import { genComponentStyleHook, mergeToken } from '../../theme';
|
2022-03-22 13:27:12 +08:00
|
|
|
|
2022-04-07 14:53:13 +08:00
|
|
|
interface AffixToken extends FullToken<'Affix'> {
|
2022-05-17 21:57:22 +08:00
|
|
|
zIndexPopup: number;
|
2022-03-22 13:27:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// ============================== Shared ==============================
|
|
|
|
const genSharedAffixStyle: GenerateStyle<AffixToken> = (token): CSSObject => {
|
2022-04-07 14:53:13 +08:00
|
|
|
const { componentCls } = token;
|
2022-03-22 13:27:12 +08:00
|
|
|
|
|
|
|
return {
|
2022-04-07 14:53:13 +08:00
|
|
|
[componentCls]: {
|
2022-03-22 13:27:12 +08:00
|
|
|
position: 'fixed',
|
2022-05-17 21:57:22 +08:00
|
|
|
zIndex: token.zIndexPopup,
|
2022-03-22 13:27:12 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
// ============================== Export ==============================
|
2022-11-19 13:47:33 +08:00
|
|
|
export default genComponentStyleHook('Affix', (token) => {
|
2022-04-11 16:04:00 +08:00
|
|
|
const affixToken = mergeToken<AffixToken>(token, {
|
2022-05-17 21:57:22 +08:00
|
|
|
zIndexPopup: token.zIndexBase + 10,
|
2022-04-11 16:04:00 +08:00
|
|
|
});
|
2022-04-07 14:53:13 +08:00
|
|
|
return [genSharedAffixStyle(affixToken)];
|
|
|
|
});
|