refactor(space): Migrate Space to Ant Design 5 (#31693)

This commit is contained in:
Mehmet Salih Yavuz 2025-01-03 18:41:03 +03:00 committed by GitHub
parent 7c90323649
commit ca12a1d466
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 121 additions and 3 deletions

View File

@ -0,0 +1,60 @@
/**
* 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.
*/
/*
* Re-exporting of components in src/components to facilitate
* their imports by other components.
* E.g. import { Select } from 'src/components'
*/
import { Space, SpaceProps } from 'src/components/Space';
export default {
title: 'Space',
component: Space,
};
export const InteractiveSpace = (args: SpaceProps) => (
<Space {...args}>
{new Array(20).fill(null).map((_, i) => (
<p key={i}>Item</p>
))}
</Space>
);
InteractiveSpace.args = {
direction: 'horizontal',
size: 'small',
wrap: false,
};
InteractiveSpace.argTypes = {
align: {
control: { type: 'select' },
options: ['start', 'end', 'center', 'baseline', ''],
},
direction: {
control: { type: 'select' },
options: ['vertical', 'horizontal'],
},
size: {
control: { type: 'select' },
options: ['small', 'middle', 'large'],
},
};

View File

@ -0,0 +1,26 @@
/**
* 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 { Space } from '.';
test('should render', () => {
const { container } = render(<Space />);
expect(container).toBeInTheDocument();
});

View File

@ -0,0 +1,33 @@
/**
* 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.
*/
/*
* Re-exporting of components in src/components to facilitate
* their imports by other components.
* E.g. import { Select } from 'src/components'
*/
import { Space as AntdSpace } from 'antd-v5';
import type { SpaceProps } from 'antd-v5/es/space';
export function Space(props: SpaceProps) {
return <AntdSpace {...props} />;
}
export { SpaceProps };

View File

@ -19,7 +19,7 @@
import { useState } from 'react';
import { css, useTheme } from '@superset-ui/core';
import { Radio } from 'src/components/Radio';
import { Space } from 'src/components';
import { Space } from 'src/components/Space';
import Icons from 'src/components/Icons';
import Popover from 'src/components/Popover';

View File

@ -37,7 +37,6 @@ export {
Grid,
Row,
Skeleton,
Space,
Steps,
Tag,
Tree,

View File

@ -30,7 +30,7 @@ import {
import { Global } from '@emotion/react';
import { Column } from 'react-table';
import { debounce } from 'lodash';
import { Space } from 'src/components';
import { Space } from 'src/components/Space';
import { Input } from 'src/components/Input';
import {
BOOL_FALSE_DISPLAY,