2022-03-22 13:27:12 +08:00
|
|
|
// deps-lint-skip-all
|
|
|
|
import { CSSObject } from '@ant-design/cssinjs';
|
2022-04-07 14:53:13 +08:00
|
|
|
import { GenerateStyle, genComponentStyleHook, FullToken } from '../../_util/theme';
|
2022-03-22 13:27:12 +08:00
|
|
|
|
2022-04-07 14:53:13 +08:00
|
|
|
interface AffixToken extends FullToken<'Affix'> {
|
2022-03-24 14:30:48 +08:00
|
|
|
zIndexAffix: 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',
|
|
|
|
zIndex: token.zIndexAffix,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
// ============================== Export ==============================
|
2022-04-07 14:53:13 +08:00
|
|
|
export default genComponentStyleHook('Affix', token => {
|
2022-03-22 13:27:12 +08:00
|
|
|
const affixToken: AffixToken = {
|
|
|
|
...token,
|
2022-03-24 14:30:48 +08:00
|
|
|
zIndexAffix: token.zIndexBase + 10,
|
2022-03-22 13:27:12 +08:00
|
|
|
};
|
2022-04-07 14:53:13 +08:00
|
|
|
return [genSharedAffixStyle(affixToken)];
|
|
|
|
});
|