ant-design/components/theme/export.ts
二货机器人 66a3594e95
refactor: Provide top theme export and theme adjuster (#36302)
* chore: change theme mode

* refactor: export theme

* refactor: top of theme

* chore: map of token

* chore: fix lint

* chore: rename

* test: fix test case
2022-06-29 20:34:00 +08:00

21 lines
719 B
TypeScript

/* eslint-disable import/prefer-default-export */
import { useToken as useInternalToken } from '.';
import defaultAlgorithm from './themes/default';
import darkAlgorithm from './themes/dark';
// ZombieJ: We export as object to user but array in internal.
// This is used to minimize the bundle size for antd package but safe to refactor as object also.
// Please do not export internal `useToken` directly to avoid something export unexpected.
/** Get current context Design Token. Will be different if you using nest theme config. */
function useToken() {
const [theme, token, hashId] = useInternalToken();
return { theme, token, hashId };
}
export default {
useToken,
defaultAlgorithm,
darkAlgorithm,
};