refactor(Divider): Migrate Divider to Ant Design 5 (#31607)
This commit is contained in:
parent
a193d790b2
commit
9321ab9deb
|
|
@ -17,7 +17,7 @@
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
import { useState, useRef, useCallback } from 'react';
|
import { useState, useRef, useCallback } from 'react';
|
||||||
import { Divider } from 'src/components';
|
import { Divider } from 'src/components/Divider';
|
||||||
import { Input } from 'src/components/Input';
|
import { Input } from 'src/components/Input';
|
||||||
import { CronPicker, CronError, CronProps } from '.';
|
import { CronPicker, CronError, CronProps } from '.';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
/**
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
import { Divider, DividerProps } from 'src/components/Divider';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
title: 'Divider',
|
||||||
|
component: Divider,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const InteractiveDivider = (args: DividerProps) => <Divider {...args} />;
|
||||||
|
|
||||||
|
InteractiveDivider.args = {
|
||||||
|
dashed: false,
|
||||||
|
variant: 'solid',
|
||||||
|
orientation: 'center',
|
||||||
|
plain: true,
|
||||||
|
type: 'horizontal',
|
||||||
|
};
|
||||||
|
|
||||||
|
InteractiveDivider.argTypes = {
|
||||||
|
variant: {
|
||||||
|
control: { type: 'select' },
|
||||||
|
options: ['dashed', 'dotted', 'solid'],
|
||||||
|
},
|
||||||
|
orientation: {
|
||||||
|
control: { type: 'select' },
|
||||||
|
options: ['left', 'right', 'center'],
|
||||||
|
},
|
||||||
|
orientationMargin: {
|
||||||
|
control: { type: 'text' },
|
||||||
|
},
|
||||||
|
type: {
|
||||||
|
control: { type: 'select' },
|
||||||
|
options: ['horizontal', 'vertical'],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
/**
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
import { render } from 'spec/helpers/testing-library';
|
||||||
|
import { Divider } from '.';
|
||||||
|
|
||||||
|
test('should render', () => {
|
||||||
|
const { container } = render(<Divider />);
|
||||||
|
expect(container).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
/**
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { Divider as AntdDivider } from 'antd-v5';
|
||||||
|
import type { DividerProps } from 'antd-v5/es/divider';
|
||||||
|
|
||||||
|
export function Divider(props: DividerProps) {
|
||||||
|
return <AntdDivider {...props} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export { DividerProps };
|
||||||
|
|
@ -34,7 +34,6 @@ export { default as Card } from './Card';
|
||||||
export {
|
export {
|
||||||
AutoComplete,
|
AutoComplete,
|
||||||
Col,
|
Col,
|
||||||
Divider,
|
|
||||||
Empty,
|
Empty,
|
||||||
Grid,
|
Grid,
|
||||||
Row,
|
Row,
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ import {
|
||||||
import Button from 'src/components/Button';
|
import Button from 'src/components/Button';
|
||||||
import ControlHeader from 'src/explore/components/ControlHeader';
|
import ControlHeader from 'src/explore/components/ControlHeader';
|
||||||
import Modal from 'src/components/Modal';
|
import Modal from 'src/components/Modal';
|
||||||
import { Divider } from 'src/components';
|
import { Divider } from 'src/components/Divider';
|
||||||
import Icons from 'src/components/Icons';
|
import Icons from 'src/components/Icons';
|
||||||
import Select from 'src/components/Select/Select';
|
import Select from 'src/components/Select/Select';
|
||||||
import { Tooltip } from 'src/components/Tooltip';
|
import { Tooltip } from 'src/components/Tooltip';
|
||||||
|
|
@ -75,7 +75,7 @@ const ContentStyleWrapper = styled.div`
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-divider-horizontal {
|
.antd5-divider-horizontal {
|
||||||
margin: 16px 0;
|
margin: 16px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import AsyncSelect from 'src/components/Select/AsyncSelect';
|
||||||
import { FormLabel } from 'src/components/Form';
|
import { FormLabel } from 'src/components/Form';
|
||||||
import { t, styled, SupersetClient } from '@superset-ui/core';
|
import { t, styled, SupersetClient } from '@superset-ui/core';
|
||||||
import { Input } from 'antd';
|
import { Input } from 'antd';
|
||||||
import { Divider } from 'src/components';
|
import { Divider } from 'src/components/Divider';
|
||||||
import Button from 'src/components/Button';
|
import Button from 'src/components/Button';
|
||||||
import { Tag } from 'src/views/CRUD/types';
|
import { Tag } from 'src/views/CRUD/types';
|
||||||
import { fetchObjectsByTagIds } from 'src/features/tags/tags';
|
import { fetchObjectsByTagIds } from 'src/features/tags/tags';
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,9 @@ const baseConfig: ThemeConfig = {
|
||||||
fontWeightStrong: supersetTheme.typography.weights.medium,
|
fontWeightStrong: supersetTheme.typography.weights.medium,
|
||||||
colorBgContainer: supersetTheme.colors.grayscale.light4,
|
colorBgContainer: supersetTheme.colors.grayscale.light4,
|
||||||
},
|
},
|
||||||
|
Divider: {
|
||||||
|
colorSplit: supersetTheme.colors.grayscale.light3,
|
||||||
|
},
|
||||||
Input: {
|
Input: {
|
||||||
colorBorder: supersetTheme.colors.secondary.light3,
|
colorBorder: supersetTheme.colors.secondary.light3,
|
||||||
colorBgContainer: supersetTheme.colors.grayscale.light5,
|
colorBgContainer: supersetTheme.colors.grayscale.light5,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue