This is an automated email from the ASF dual-hosted git repository.

enzomartellucci pushed a commit to branch 
enxdev/refactor/migrate-Breadcrumb-to-antd5
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 9dc809a9df810a03415de02dab5c0df300e0fb2b
Author: Enzo Martellucci <[email protected]>
AuthorDate: Fri Mar 28 21:07:45 2025 +0100

    feat(Breadcrumb): add wrapper for Breadcrumb component, with test and story
---
 .../components/Breadcrumb/Breadcrumb.stories.tsx   | 57 ++++++++++++++++++++++
 .../src/components/Breadcrumb/Breadcrumb.test.tsx  | 37 ++++++++++++++
 .../src/components/Breadcrumb/index.tsx            | 21 ++++++++
 3 files changed, 115 insertions(+)

diff --git a/superset-frontend/src/components/Breadcrumb/Breadcrumb.stories.tsx 
b/superset-frontend/src/components/Breadcrumb/Breadcrumb.stories.tsx
new file mode 100644
index 0000000000..d0fdd2f481
--- /dev/null
+++ b/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 = {
+  args: {
+    separator: '/',
+    items: [
+      { title: 'Home', href: '/' },
+      { title: 'Library', href: '/library' },
+      { title: 'Data' },
+    ],
+  },
+  render: args => <Breadcrumb {...args} />,
+};
diff --git a/superset-frontend/src/components/Breadcrumb/Breadcrumb.test.tsx 
b/superset-frontend/src/components/Breadcrumb/Breadcrumb.test.tsx
new file mode 100644
index 0000000000..4907ff209e
--- /dev/null
+++ b/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();
+    expect(screen.getByText('Library')).toBeInTheDocument();
+    expect(screen.getByText('Data')).toBeInTheDocument();
+  });
+});
diff --git a/superset-frontend/src/components/Breadcrumb/index.tsx 
b/superset-frontend/src/components/Breadcrumb/index.tsx
new file mode 100644
index 0000000000..db91a23f95
--- /dev/null
+++ b/superset-frontend/src/components/Breadcrumb/index.tsx
@@ -0,0 +1,21 @@
+/**
+ * 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 { Breadcrumb as antdBreadcrumb } from 'antd-v5';
+
+export const Breadcrumb = antdBreadcrumb;

Reply via email to