mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-13 15:49:10 +08:00
5d9cb2e50d
* refactor: Optimize theme export and add docs * chore: fix lint * chore: fix lint * chore: fix lint
28 lines
846 B
TypeScript
28 lines
846 B
TypeScript
import type { CSSObject } from '@ant-design/cssinjs';
|
|
import type { FullToken, GenerateStyle } from '../../theme/internal';
|
|
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
|
|
|
interface AffixToken extends FullToken<'Affix'> {
|
|
zIndexPopup: number;
|
|
}
|
|
|
|
// ============================== Shared ==============================
|
|
const genSharedAffixStyle: GenerateStyle<AffixToken> = (token): CSSObject => {
|
|
const { componentCls } = token;
|
|
|
|
return {
|
|
[componentCls]: {
|
|
position: 'fixed',
|
|
zIndex: token.zIndexPopup,
|
|
},
|
|
};
|
|
};
|
|
|
|
// ============================== Export ==============================
|
|
export default genComponentStyleHook('Affix', (token) => {
|
|
const affixToken = mergeToken<AffixToken>(token, {
|
|
zIndexPopup: token.zIndexBase + 10,
|
|
});
|
|
return [genSharedAffixStyle(affixToken)];
|
|
});
|