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

fix: tree switcher's background display unexpected in dark theme #39838

Merged
merged 3 commits into from Dec 27, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
65 changes: 65 additions & 0 deletions components/tree/demo/basic-dark.tsx
@@ -0,0 +1,65 @@
import React from 'react';
import { Tree, ConfigProvider, theme } from 'antd';
import type { DataNode, TreeProps } from 'antd/es/tree';

const { darkAlgorithm } = theme;

const treeData: DataNode[] = [
{
title: 'parent 1',
key: '0-0',
children: [
{
title: 'parent 1-0',
key: '0-0-0',
disabled: true,
children: [
{
title: 'leaf',
key: '0-0-0-0',
disableCheckbox: true,
},
{
title: 'leaf',
key: '0-0-0-1',
},
],
},
{
title: 'parent 1-1',
key: '0-0-1',
children: [{ title: <span style={{ color: '#1890ff' }}>sss</span>, key: '0-0-1-0' }],
},
],
},
];

const App: React.FC = () => {
const onSelect: TreeProps['onSelect'] = (selectedKeys, info) => {
console.log('selected', selectedKeys, info);
};

const onCheck: TreeProps['onCheck'] = (checkedKeys, info) => {
console.log('onCheck', checkedKeys, info);
};

return (
<ConfigProvider
theme={{
algorithm: [darkAlgorithm],
}}
>
<Tree
showLine
defaultExpandedKeys={['0-0-0', '0-0-1']}
defaultSelectedKeys={['0-0-0', '0-0-1']}
defaultCheckedKeys={['0-0-0', '0-0-1']}
onSelect={onSelect}
onCheck={onCheck}
treeData={treeData}
/>
</ConfigProvider>
);
};

export default App;
1 change: 1 addition & 0 deletions components/tree/index.zh-CN.md
Expand Up @@ -18,6 +18,7 @@ demo:

<!-- prettier-ignore -->
<code src="./demo/basic.tsx">基本</code>
<code src="./demo/basic-dark.tsx">基本-暗色模式</code>
kiner-tang marked this conversation as resolved.
Show resolved Hide resolved
<code src="./demo/basic-controlled.tsx">受控操作示例</code>
<code src="./demo/draggable.tsx">拖动示例</code>
<code src="./demo/dynamic.tsx">异步数据加载</code>
Expand Down
2 changes: 1 addition & 1 deletion components/tree/style/index.tsx
Expand Up @@ -347,7 +347,7 @@ export const genBaseStyle = (prefixCls: string, token: TreeToken): CSSObject =>

// ============== Cover Background ==============
[`${treeCls}-switcher`]: {
background: token.colorBgContainer,
background: 'transparent',

'&-line-icon': {
// https://github.com/ant-design/ant-design/issues/32813
Expand Down