ant-design/components/affix/style/index.tsx

28 lines
828 B
TypeScript
Raw Normal View History

2022-05-09 22:20:07 +08:00
import type { CSSObject } from '@ant-design/cssinjs';
import type { FullToken, GenerateStyle } from '../../theme';
import { genComponentStyleHook, mergeToken } from '../../theme';
interface AffixToken extends FullToken<'Affix'> {
2022-05-17 21:57:22 +08:00
zIndexPopup: number;
}
// ============================== Shared ==============================
const genSharedAffixStyle: GenerateStyle<AffixToken> = (token): CSSObject => {
const { componentCls } = token;
return {
[componentCls]: {
position: 'fixed',
2022-05-17 21:57:22 +08:00
zIndex: token.zIndexPopup,
},
};
};
// ============================== Export ==============================
export default genComponentStyleHook('Affix', (token) => {
const affixToken = mergeToken<AffixToken>(token, {
2022-05-17 21:57:22 +08:00
zIndexPopup: token.zIndexBase + 10,
});
return [genSharedAffixStyle(affixToken)];
});