msyavuz commented on code in PR #32905:
URL: https://github.com/apache/superset/pull/32905#discussion_r2039143611
##########
superset-frontend/src/components/Alert/Alert.stories.tsx:
##########
@@ -30,7 +30,7 @@ const bigText =
'purus convallis placerat in at nunc. Nulla nec viverra augue.';
export default {
- title: 'Alert',
+ title: 'Components/Alert',
Review Comment:
I think it looks better this way too. But if we start doing this it should
be standardized as well. cc @geido
##########
superset-frontend/src/components/Chart/DrillBy/useDrillByBreadcrumbs.tsx:
##########
@@ -26,23 +26,23 @@ import {
styled,
Review Comment:
This file is entirely unused if we move the logic back into the
DrillByModal. I think having the logic here and using this hook in DrillByModal
makes better sense.
##########
superset-frontend/src/components/Chart/DrillBy/DrillByModal.tsx:
##########
@@ -308,8 +311,35 @@ export default function DrillByModal({
},
[dispatch, drillByConfigs, formData, getFormDataChangesFromConfigs],
);
-
- const breadcrumbs = useDrillByBreadcrumbs(breadcrumbsData,
onBreadcrumbClick);
+ const breadcrumbItems = breadcrumbsData
Review Comment:
I am a bit confused here. We used to have a hook where we extracted this
logic into. That hook seems to be unused now? Maybe we should modify the hook
to return items and pass those items to breadcrumb here?
##########
superset-frontend/src/components/index.ts:
##########
@@ -24,8 +24,11 @@
*/
// TODO: Remove these imports
// eslint-disable-next-line no-restricted-imports
-export { Breadcrumb as AntdBreadcrumb } from 'antd';
-
+export {
+ Checkbox as AntdCheckbox,
+ Collapse as AntdCollapse,
+ Select as AntdSelect,
+} from 'antd';
Review Comment:
I don't think we should add these imports again here. These component are
all migrated to Antd v5.
##########
superset-frontend/src/components/Breadcrumb/Breadcrumb.stories.tsx:
##########
@@ -0,0 +1,57 @@
+/**
+ * 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 type { Meta, StoryObj } from '@storybook/react';
+import { Breadcrumb } from '.';
+
+const meta: Meta<typeof Breadcrumb> = {
+ title: 'Breadcrumb',
+ component: Breadcrumb,
+ tags: ['autodocs'],
+ argTypes: {
+ separator: {
+ control: 'text',
+ description: 'Custom separator between items',
+ defaultValue: '/',
+ },
+ items: {
+ control: 'object',
+ description: 'List of breadcrumb items',
+ defaultValue: [
+ { title: 'Home', href: '/' },
+ { title: 'Library', href: '/library' },
+ { title: 'Data' },
+ ],
+ },
+ },
+};
+
+export default meta;
+type Story = StoryObj<typeof Breadcrumb>;
+
+export const Default: Story = {
Review Comment:
I agree with this as well
##########
superset-frontend/src/components/Breadcrumb/Breadcrumb.test.tsx:
##########
@@ -0,0 +1,37 @@
+/**
+ * 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, screen } from '@testing-library/react';
+import '@testing-library/jest-dom';
+import { Breadcrumb } from '.';
+
+describe('Breadcrumb Component', () => {
+ test('renders breadcrumb items correctly', () => {
+ render(
+ <Breadcrumb>
+ <Breadcrumb.Item>Home</Breadcrumb.Item>
+ <Breadcrumb.Item>Library</Breadcrumb.Item>
+ <Breadcrumb.Item>Data</Breadcrumb.Item>
+ </Breadcrumb>,
+ );
+
+ expect(screen.getByText('Home')).toBeInTheDocument();
Review Comment:
Agreed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]