mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-04 08:59:40 +08:00
d952088650
* chore: colorHighlight * chore: bgSecondary * chore: colorLink * chore: link style * chore: rm fly variables * chore: colorAction * chore: add warning comment * chore: token outline * chore: colorBgXXX * chore: alert * rm: zIndex * chore: rm zIndexComponent * fix: tag color checkabl * chore: tags tmp
46 lines
1.0 KiB
TypeScript
46 lines
1.0 KiB
TypeScript
// deps-lint-skip-all
|
|
import { CSSObject } from '@ant-design/cssinjs';
|
|
import {
|
|
DerivativeToken,
|
|
useStyleRegister,
|
|
useToken,
|
|
UseComponentStyleResult,
|
|
GenerateStyle,
|
|
} from '../../_util/theme';
|
|
|
|
interface AffixToken extends DerivativeToken {
|
|
affixCls: string;
|
|
zIndexAffix: number;
|
|
}
|
|
|
|
// ============================== Shared ==============================
|
|
const genSharedAffixStyle: GenerateStyle<AffixToken> = (token): CSSObject => {
|
|
const { affixCls } = token;
|
|
|
|
return {
|
|
[affixCls]: {
|
|
position: 'fixed',
|
|
zIndex: token.zIndexAffix,
|
|
},
|
|
};
|
|
};
|
|
|
|
// ============================== Export ==============================
|
|
export default function useStyle(prefixCls: string): UseComponentStyleResult {
|
|
const [theme, token, hashId] = useToken();
|
|
|
|
const affixToken: AffixToken = {
|
|
...token,
|
|
|
|
affixCls: `.${prefixCls}`,
|
|
zIndexAffix: token.zIndexBase + 10,
|
|
};
|
|
|
|
return [
|
|
useStyleRegister({ theme, token, hashId, path: [prefixCls] }, () => [
|
|
genSharedAffixStyle(affixToken),
|
|
]),
|
|
hashId,
|
|
];
|
|
}
|