refactor: import css-in-js utils from theme (#35215)

This commit is contained in:
afc163 2022-04-24 18:05:08 +08:00 committed by GitHub
parent 4ebe262426
commit 3d23b809b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 10 deletions

View File

@ -3,9 +3,9 @@ import { CSSInterpolation, Theme, useCacheToken, useStyleRegister } from '@ant-d
import genComponentStyleHook from './util/genComponentStyleHook';
import defaultSeedToken, { derivative as defaultDerivative } from './themes/default';
import version from '../../version';
import { resetComponent, resetIcon, clearFix, roundedArrow } from './util';
import { resetComponent, resetIcon, clearFix, roundedArrow, operationUnit } from './util';
import formatToken from './util/alias';
import statisticToken, { merge as mergeToken } from './util/statistic';
import statisticToken, { merge as mergeToken, statistic } from './util/statistic';
import { GlobalToken, PresetColors } from './interface';
import type {
SeedToken,
@ -17,16 +17,20 @@ import type {
import type { FullToken } from './util/genComponentStyleHook';
export {
PresetColors,
// css utils
resetComponent,
resetIcon,
clearFix,
roundedArrow,
useStyleRegister,
operationUnit,
// colors
PresetColors,
// Statistic
statistic,
statisticToken,
mergeToken,
// GenComponentStyleHook
// hooks
useStyleRegister,
genComponentStyleHook,
};

View File

@ -2,6 +2,7 @@
import { CSSObject } from '@ant-design/cssinjs';
import type { DerivativeToken } from '..';
export { operationUnit } from './operationUnit';
export { roundedArrow } from './roundedArrow';
export const resetComponent = (token: DerivativeToken): CSSObject => ({

View File

@ -1,7 +1,6 @@
// deps-lint-skip-all
import { FullToken, genComponentStyleHook } from '../../_util/theme';
import type { GenerateStyle } from '../../_util/theme';
import { operationUnit } from '../../_util/theme/util/operationUnit';
import type { FullToken, GenerateStyle } from '../../_util/theme';
import { genComponentStyleHook, operationUnit } from '../../_util/theme';
import {
getTitleStyles,
getResetStyles,

View File

@ -10,7 +10,7 @@
import { gold } from '@ant-design/colors';
import type { CSSObject } from '@ant-design/cssinjs';
import type { GenerateStyle } from '../../_util/theme';
import { operationUnit } from '../../_util/theme/util/operationUnit';
import { operationUnit } from '../../_util/theme';
import { initInputToken } from '../../input/style';
import type { TypographyToken } from '.';
@ -107,6 +107,7 @@ export const getResetStyles = (): CSSObject => ({
mark: {
padding: 0,
// FIXME hardcode in v4
backgroundColor: gold[2],
},

View File

@ -1,7 +1,7 @@
/* eslint-disable react/no-array-index-key */
import * as React from 'react';
import { Table, Space, TableProps, ConfigProvider, Select, Row, Col, Alert } from 'antd';
import { statistic } from '../../../../../components/_util/theme/util/statistic';
import { statistic } from '../../../../../components/_util/theme';
const columns: TableProps<{ name: string; value: any }>['columns'] = [
{