Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: migrate less to token for Switch #42192

Merged
merged 7 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion components/switch/__tests__/demo-extend.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { extendTest } from '../../../tests/shared/demoTest';

extendTest('switch');
extendTest('switch', {
skip: ['component-token.tsx'],
});
4 changes: 3 additions & 1 deletion components/switch/__tests__/demo.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import demoTest from '../../../tests/shared/demoTest';

demoTest('switch');
demoTest('switch', {
skip: ['component-token.tsx'],
});
7 changes: 7 additions & 0 deletions components/switch/demo/component-token.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## zh-CN

自定义组件 Token。

## en-US

Custom component token.
30 changes: 30 additions & 0 deletions components/switch/demo/component-token.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react';
import { ConfigProvider, Space, Switch } from 'antd';

const App: React.FC = () => (
<ConfigProvider
theme={{
components: {
Switch: {
trackHeight: 14,
trackMinWidth: 32,
// opacityLoading: 0.1,
colorPrimary: 'rgb(25, 118, 210, 0.5)',
trackPadding: -3,
handleSize: 20,
handleBg: 'rgb(25, 118, 210)',
handleShadow:
'rgba(0, 0, 0, 0.2) 0px 2px 1px -1px, rgba(0, 0, 0, 0.14) 0px 1px 1px 0px, rgba(0, 0, 0, 0.12) 0px 1px 3px 0px',
// innerMinMargin: 4,
// innerMaxMargin: 8,
},
},
}}
>
<Space>
<Switch defaultChecked />
</Space>
</ConfigProvider>
);

export default App;
1 change: 1 addition & 0 deletions components/switch/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Switching Selector.
<code src="./demo/text.tsx">Text & icon</code>
<code src="./demo/size.tsx">Two sizes</code>
<code src="./demo/loading.tsx">Loading</code>
<code src="./demo/component-token.tsx" debug>Custom component token</code>

## API

Expand Down
1 change: 1 addition & 0 deletions components/switch/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ demo:
<code src="./demo/text.tsx">文字和图标</code>
<code src="./demo/size.tsx">两种大小</code>
<code src="./demo/loading.tsx">加载中</code>
<code src="./demo/component-token.tsx" debug>自定义组件 Token</code>

## API

Expand Down