Skip to content

Commit

Permalink
refactor(style, antd5): 移除 generateAntdVars 方法
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `style` 移除 `generateAntdVars` 方法
  • Loading branch information
twinh committed May 5, 2023
1 parent 9b4bf4a commit cff65ee
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 32 deletions.
12 changes: 0 additions & 12 deletions __tests__/__snapshots__/index.js.snap
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`style generateAntdVars 1`] = `
Object {
"blue-base": "#1cb7f0",
"cyan-base": "#5bc0de",
"green-base": "#5cb85c",
"red-base": "#fa5b50",
"success-color": "#5cb85c",
"warning-color": "#f28c48",
"yellow-base": "#f28c48",
}
`;

exports[`style generateBootstrapVars 1`] = `
"$blue: #1cb7f0 !default;
$green: #5cb85c !default;
Expand Down
7 changes: 1 addition & 6 deletions __tests__/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import {generateBootstrapVars, generateAntdVars} from '../utils';
import {generateBootstrapVars} from '../utils';
import theme from '../theme-preset';

describe('style', () => {
test('generateBootstrapVars', () => {
const result = generateBootstrapVars(theme);
expect(result).toMatchSnapshot();
});

test('generateAntdVars', () => {
const result = generateAntdVars(theme);
expect(result).toMatchSnapshot();
});
});

14 changes: 0 additions & 14 deletions utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,6 @@
* NOTE: 仅支持小部分变量的转换,其他需要可以再加上
*/

function generateAntdVars(theme) {
return {
'blue-base': theme.colors.blue['500'],
'green-base': theme.colors.green['500'],
'yellow-base': theme.colors.yellow['500'],
'red-base': theme.colors.red['500'],
'cyan-base': theme.colors.cyan['500'],
// 用于 antd-button-color
'success-color': theme.colors.green['500'],
'warning-color': theme.colors.yellow['500'],
};
}

function generateBootstrapVars(theme) {
const vars = {
blue: theme.colors.blue['500'],
Expand All @@ -32,6 +19,5 @@ function generateBootstrapVars(theme) {
}

module.exports = {
generateAntdVars,
generateBootstrapVars,
};

0 comments on commit cff65ee

Please sign in to comment.