mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-15 08:59:15 +08:00
b88ac06b8c
* refactor: solve theme circular dependency issue * refactor: solve theme circular dependency issue * refactor: solve theme circular dependency issue * refactor: solve theme circular dependency issue * refactor: solve theme circular dependency issue * refactor: solve theme circular dependency issue
23 lines
788 B
TypeScript
23 lines
788 B
TypeScript
import type { Theme } from '@ant-design/cssinjs';
|
|
import { createTheme } from '@ant-design/cssinjs';
|
|
import React from 'react';
|
|
import type { AliasToken, MapToken, OverrideToken, SeedToken } from './interface';
|
|
import defaultDerivative from './themes/default';
|
|
import defaultSeedToken from './themes/seed';
|
|
|
|
export const defaultTheme = createTheme(defaultDerivative);
|
|
|
|
// ================================ Context =================================
|
|
// To ensure snapshot stable. We disable hashed in test env.
|
|
export const defaultConfig = {
|
|
token: defaultSeedToken,
|
|
hashed: true,
|
|
};
|
|
|
|
export const DesignTokenContext = React.createContext<{
|
|
token: Partial<AliasToken>;
|
|
theme?: Theme<SeedToken, MapToken>;
|
|
components?: OverrideToken;
|
|
hashed?: string | boolean;
|
|
}>(defaultConfig);
|