diff --git a/.storybook/preview.tsx b/.storybook/preview.tsx index 835343d79..f0c9faef4 100644 --- a/.storybook/preview.tsx +++ b/.storybook/preview.tsx @@ -33,7 +33,7 @@ const preview: Preview = { // 👇 Defining the decorator in the preview file applies it to all stories (Story, { parameters }) => { return ( - + diff --git a/src/components/Canary/Canary.stories.tsx b/src/components/Canary/Canary.stories.tsx index 0cad5b8ea..2389c4d0e 100644 --- a/src/components/Canary/Canary.stories.tsx +++ b/src/components/Canary/Canary.stories.tsx @@ -1,23 +1,11 @@ -import { MemoryRouter } from "react-router-dom"; -import { Canary } from "./index"; -import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { ComponentMeta, ComponentStory } from "@storybook/react"; - -const queryClient = new QueryClient(); +import { Canary } from "./index"; export default { title: "Canary", component: Canary, argTypes: {}, - decorators: [ - (Story) => ( - - - - - - ) - ] + decorators: [(Story) => ] } as ComponentMeta; const Template: ComponentStory = (arg) => ; diff --git a/src/components/Canary/HealthSummary.stories.tsx b/src/components/Canary/HealthSummary.stories.tsx index 6cf42b64d..e2e7def00 100644 --- a/src/components/Canary/HealthSummary.stories.tsx +++ b/src/components/Canary/HealthSummary.stories.tsx @@ -1,17 +1,10 @@ import { Meta, StoryFn } from "@storybook/react"; -import { MemoryRouter } from "react-router-dom"; import { HealthSummary } from "./HealthSummary"; export default { title: "HealthSummary", component: HealthSummary, - decorators: [ - (Story) => ( - - - - ) - ] + decorators: [(Story) => ] } as Meta; const component = { diff --git a/src/components/Configs/Changes/ConfigChangeTable.stories.tsx b/src/components/Configs/Changes/ConfigChangeTable.stories.tsx index 5d06a874b..00d62964c 100644 --- a/src/components/Configs/Changes/ConfigChangeTable.stories.tsx +++ b/src/components/Configs/Changes/ConfigChangeTable.stories.tsx @@ -1,6 +1,4 @@ import { Meta, StoryFn } from "@storybook/react"; -import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; -import { MemoryRouter } from "react-router-dom"; import { ConfigChange } from "../../../api/types/configs"; import { ConfigChangeTable } from "./ConfigChangeTable"; @@ -9,14 +7,7 @@ export default { component: ConfigChangeTable, decorators: [ (Story) => { - const queryClient = new QueryClient(); - return ( - - - - - - ); + return ; } ] } satisfies Meta; diff --git a/src/components/Configs/ConfigList/ConfigList.stories.tsx b/src/components/Configs/ConfigList/ConfigList.stories.tsx index 26623cdfc..c4e2cd208 100644 --- a/src/components/Configs/ConfigList/ConfigList.stories.tsx +++ b/src/components/Configs/ConfigList/ConfigList.stories.tsx @@ -1,18 +1,11 @@ import { ComponentMeta, ComponentStory } from "@storybook/react"; -import { MemoryRouter } from "react-router-dom"; import sampleConfigList from "../../../data/sampleConfigList"; import ConfigsTable from "./ConfigsTable"; export default { title: "ConfigList", component: ConfigsTable, - decorators: [ - (Story) => ( - - - - ) - ] + decorators: [(Story) => ] } as ComponentMeta; const Template: ComponentStory = (args) => ( diff --git a/src/components/Configs/QueryBuilder/QueryBuilder.stories.tsx b/src/components/Configs/QueryBuilder/QueryBuilder.stories.tsx index 87a002408..8fc95e281 100644 --- a/src/components/Configs/QueryBuilder/QueryBuilder.stories.tsx +++ b/src/components/Configs/QueryBuilder/QueryBuilder.stories.tsx @@ -1,17 +1,10 @@ -import { MemoryRouter } from "react-router-dom"; -import { QueryBuilder } from "./index"; import { ComponentMeta, ComponentStory } from "@storybook/react"; +import { QueryBuilder } from "./index"; export default { title: "QueryBuilder", component: QueryBuilder, - decorators: [ - (Story) => ( - - - - ) - ] + decorators: [(Story) => ] } as ComponentMeta; const Template: ComponentStory = (arg) => ( diff --git a/src/components/Forms/SpecEditorForm.stories.tsx b/src/components/Forms/SpecEditorForm.stories.tsx index b9c867595..6e5ddfdeb 100644 --- a/src/components/Forms/SpecEditorForm.stories.tsx +++ b/src/components/Forms/SpecEditorForm.stories.tsx @@ -1,27 +1,19 @@ import { Story } from "@storybook/react"; -import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import React, { ComponentProps } from "react"; -import { MemoryRouter } from "react-router-dom"; import { schemaResourceTypes } from "../SchemaResourcePage/resourceTypes"; import AWSConfigsFormEditor from "./Configs/AWSConfigsFormEditor"; import KubernetesConfigsFormEditor from "./Configs/KubernetesConfigsFormEditor"; import { HTTPHealthFormEditor } from "./Health/HTTPHealthFormEditor"; import SpecEditorForm from "./SpecEditorForm"; -const defaultQueryClient = new QueryClient(); - export default { title: "SpecEditorForm", component: SpecEditorForm, decorators: [ (Story: React.FC) => ( - - -
- -
-
-
+
+ +
) ] }; diff --git a/src/components/Incidents/Hypothesis/EvidenceSection/EvidenceSection.stories.tsx b/src/components/Incidents/Hypothesis/EvidenceSection/EvidenceSection.stories.tsx index b3bcd1f58..1311200ec 100644 --- a/src/components/Incidents/Hypothesis/EvidenceSection/EvidenceSection.stories.tsx +++ b/src/components/Incidents/Hypothesis/EvidenceSection/EvidenceSection.stories.tsx @@ -1,25 +1,13 @@ import { ComponentMeta, ComponentStory } from "@storybook/react"; -import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; -import { MemoryRouter } from "react-router-dom"; import { EvidenceType } from "../../../../api/types/evidence"; import { sampleIncidentNode } from "../../../../data/sampleIncident"; import { EvidenceSection } from "./index"; -const client = new QueryClient(); - export default { title: "EvidenceSection", component: EvidenceSection, parameters: { actions: { argTypesRegex: "^on.*" } }, - decorators: [ - (Story) => ( - - - - - - ) - ] + decorators: [(Story) => ] } as ComponentMeta; const Template: ComponentStory = (arg: any) => ( diff --git a/src/components/Incidents/Hypothesis/HypothesisDetails/HypothesisDetails.stories.tsx b/src/components/Incidents/Hypothesis/HypothesisDetails/HypothesisDetails.stories.tsx index a7d7a25e9..3246b4a07 100644 --- a/src/components/Incidents/Hypothesis/HypothesisDetails/HypothesisDetails.stories.tsx +++ b/src/components/Incidents/Hypothesis/HypothesisDetails/HypothesisDetails.stories.tsx @@ -1,23 +1,11 @@ import { ComponentMeta, ComponentStory } from "@storybook/react"; -import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; -import { MemoryRouter } from "react-router-dom"; import { sampleIncidentNode } from "../../../../data/sampleIncident"; import { HypothesisDetails } from "./index"; -const defaultQueryClient = new QueryClient(); - export default { title: "HypothesisDetails", component: HypothesisDetails, - decorators: [ - (Story) => ( - - - - - - ) - ], + decorators: [(Story) => ], parameters: { actions: { argTypesRegex: "^on.*" } } } as ComponentMeta; diff --git a/src/components/Incidents/Hypothesis/HypothesisNode/HypothesisNode.stories.tsx b/src/components/Incidents/Hypothesis/HypothesisNode/HypothesisNode.stories.tsx index 3b9f0bb79..2abbc98d7 100644 --- a/src/components/Incidents/Hypothesis/HypothesisNode/HypothesisNode.stories.tsx +++ b/src/components/Incidents/Hypothesis/HypothesisNode/HypothesisNode.stories.tsx @@ -1,6 +1,5 @@ import { ComponentMeta, ComponentStory } from "@storybook/react"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; -import { MemoryRouter } from "react-router-dom"; import { sampleIncidentNode } from "../../../../data/sampleIncident"; import { HypothesisNode } from "./index"; @@ -10,13 +9,7 @@ export default { title: "HypothesisNode", component: HypothesisNode, parameters: { actions: { argTypesRegex: "^on.*" } }, - decorators: [ - (Story) => ( - - - - ) - ] + decorators: [(Story) => ] } as ComponentMeta; const Template: ComponentStory = (arg: any) => ( diff --git a/src/components/Incidents/IncidentDetails/IncidentDetails.stories.tsx b/src/components/Incidents/IncidentDetails/IncidentDetails.stories.tsx index 06a7c6fc0..09b076efa 100644 --- a/src/components/Incidents/IncidentDetails/IncidentDetails.stories.tsx +++ b/src/components/Incidents/IncidentDetails/IncidentDetails.stories.tsx @@ -1,6 +1,4 @@ import { ComponentMeta, ComponentStory } from "@storybook/react"; -import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; -import { MemoryRouter } from "react-router-dom"; import { IncidentSeverity, IncidentStatus } from "../../../api/types/incident"; import { IncidentSidebar } from "./IncidentSidebar"; @@ -9,14 +7,7 @@ export default { component: IncidentSidebar, decorators: [ (Story) => { - const queryClient = new QueryClient(); - return ( - - - - - - ); + return ; } ], parameters: { actions: { argTypesRegex: "^on.*" } } diff --git a/src/components/Incidents/IncidentList/incidenttList.stories.tsx b/src/components/Incidents/IncidentList/incidenttList.stories.tsx index 24e9a9d71..9f4bfcba3 100644 --- a/src/components/Incidents/IncidentList/incidenttList.stories.tsx +++ b/src/components/Incidents/IncidentList/incidenttList.stories.tsx @@ -1,12 +1,11 @@ -import React from "react"; -import { MemoryRouter, Route, Routes } from "react-router-dom"; +import { ComponentStory } from "@storybook/react"; +import { Route, Routes } from "react-router-dom"; import { IncidentSeverity, IncidentStatus, IncidentSummary } from "../../../api/types/incident"; import { IncidentList } from "./index"; -import { ComponentStory } from "@storybook/react"; export default { title: "IncidentList", @@ -92,11 +91,9 @@ const incidents: IncidentSummary[] = [ ]; const Template: ComponentStory = (arg) => ( - - - } path="/incidents" /> - - + + } path="/incidents" /> + ); export const Variant1 = Template.bind({}); diff --git a/src/components/Logs/LogsViewer.stories.tsx b/src/components/Logs/LogsViewer.stories.tsx index c7d0631e3..d49c24152 100644 --- a/src/components/Logs/LogsViewer.stories.tsx +++ b/src/components/Logs/LogsViewer.stories.tsx @@ -1,22 +1,10 @@ -import { MemoryRouter } from "react-router-dom"; -import { LogsViewer } from "./index"; -import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { ComponentMeta, ComponentStory } from "@storybook/react"; - -const client = new QueryClient(); +import { LogsViewer } from "./index"; export default { title: "LogsViewer", component: LogsViewer, - decorators: [ - (Story) => ( - - - - - - ) - ] + decorators: [(Story) => ] } as ComponentMeta; const logsExample = [ diff --git a/src/components/RefreshDropdown/RefreshDropdown.stories.tsx b/src/components/RefreshDropdown/RefreshDropdown.stories.tsx index 044255166..f2c3467b0 100644 --- a/src/components/RefreshDropdown/RefreshDropdown.stories.tsx +++ b/src/components/RefreshDropdown/RefreshDropdown.stories.tsx @@ -1,16 +1,9 @@ import { ComponentMeta, ComponentStory } from "@storybook/react"; import RefreshDropdown from "./index"; -import { MemoryRouter } from "react-router-dom"; export default { title: "RefreshDropdown", component: RefreshDropdown, - decorators: [ - (Story) => ( - - - - ) - ], + decorators: [(Story) => ], args: { // eslint-disable-next-line no-alert onClick: () => alert("hello!"), diff --git a/src/components/SchemaResourcePage/SchemaResource.stories.tsx b/src/components/SchemaResourcePage/SchemaResource.stories.tsx index d46f27704..abb58de22 100644 --- a/src/components/SchemaResourcePage/SchemaResource.stories.tsx +++ b/src/components/SchemaResourcePage/SchemaResource.stories.tsx @@ -1,29 +1,11 @@ -import { MemoryRouter } from "react-router-dom"; import { ComponentMeta, ComponentStory } from "@storybook/react"; -import { SchemaResource } from "./SchemaResource"; -import { - QueryClientProvider, - QueryClient, - QueryCache -} from "@tanstack/react-query"; import { schemaResourceTypes } from "./resourceTypes"; - -const queryClient = new QueryClient({ - queryCache: new QueryCache() -}); +import { SchemaResource } from "./SchemaResource"; export default { title: "SchemaResource", component: SchemaResource, - decorators: [ - (Story) => ( - - - - - - ) - ], + decorators: [(Story) => ], parameters: { actions: { argTypesRegex: "^on.*" } } } as ComponentMeta; diff --git a/src/components/SchemaResourcePage/SchemaResourceEdit.stories.tsx b/src/components/SchemaResourcePage/SchemaResourceEdit.stories.tsx index 4730bd26e..681e9eb1c 100644 --- a/src/components/SchemaResourcePage/SchemaResourceEdit.stories.tsx +++ b/src/components/SchemaResourcePage/SchemaResourceEdit.stories.tsx @@ -1,12 +1,7 @@ import { Meta, StoryFn } from "@storybook/react"; -import { QueryClient } from "@tanstack/query-core"; -import { QueryClientProvider } from "@tanstack/react-query"; -import { MemoryRouter } from "react-router-dom"; import { SchemaResourceEdit } from "./SchemaResourceEdit"; import { schemaResourceTypes } from "./resourceTypes"; -const queryClient = new QueryClient(); - export default { title: "SchemaResourceEdit", component: SchemaResourceEdit, @@ -14,11 +9,7 @@ export default { } as Meta; const Template: StoryFn = (arg: any) => ( - - - - - + ); export const Base = Template.bind({}); diff --git a/src/components/SchemaResourcePage/SchemaResourceList.stories.tsx b/src/components/SchemaResourcePage/SchemaResourceList.stories.tsx deleted file mode 100644 index 883e00ec7..000000000 --- a/src/components/SchemaResourcePage/SchemaResourceList.stories.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import { ComponentMeta, ComponentStory } from "@storybook/react"; -import { MemoryRouter } from "react-router-dom"; -import { SchemaResourceWithJobStatus } from "../../api/schemaResources"; -import { SchemaResourceList } from "./SchemaResourceList"; -import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; - -const queryClient = new QueryClient(); - -export default { - title: "SchemaResourceList", - component: SchemaResourceList, - parameters: { actions: { argTypesRegex: "^on.*" } }, - decorators: [ - (Story) => ( - - - - - - ) - ] -} as ComponentMeta; - -const Template: ComponentStory = (arg: any) => ( - -); - -const genItem = (suffix: string): SchemaResourceWithJobStatus => ({ - integration_type: "scrapers", - name: `item ${suffix}`, - spec: { a: suffix, b: 2 }, - created_at: "asd", - updated_at: "ass", - namespace: "default", - labels: {}, - source: "", - id: "asdas" -}); - -export const Base = Template.bind({}); -Base.args = { - items: [genItem("1"), genItem("two"), genItem("another")] -}; diff --git a/src/components/Topology/Sidebar/sidebar.stories.tsx b/src/components/Topology/Sidebar/sidebar.stories.tsx index 94d757567..633bca1fa 100644 --- a/src/components/Topology/Sidebar/sidebar.stories.tsx +++ b/src/components/Topology/Sidebar/sidebar.stories.tsx @@ -1,27 +1,15 @@ -import TopologyDetails from "./TopologyDetails"; -import topology from "../../../data/topology.json"; import { StoryObj } from "@storybook/react"; -import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; -import { MemoryRouter } from "react-router-dom"; +import topology from "../../../data/topology.json"; +import TopologyDetails from "./TopologyDetails"; export default { title: "TopologySidebar", component: TopologyDetails }; -const queryClient = new QueryClient(); - type Story = StoryObj; export const Default: Story = { - decorators: [ - (Story) => ( - - - - - - ) - ], + decorators: [(Story) => ], render: () => }; diff --git a/src/components/Topology/TopologyCard/TopologyCard.stories.tsx b/src/components/Topology/TopologyCard/TopologyCard.stories.tsx index db2040d4f..266d2cc20 100644 --- a/src/components/Topology/TopologyCard/TopologyCard.stories.tsx +++ b/src/components/Topology/TopologyCard/TopologyCard.stories.tsx @@ -1,25 +1,13 @@ import { ComponentMeta, ComponentStory } from "@storybook/react"; -import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; -import { MemoryRouter } from "react-router-dom"; +import { Topology } from "../../../api/types/topology"; import { Size } from "../../../types"; import { TopologyCard } from "./index"; -import { Topology } from "../../../api/types/topology"; - -const defaultQueryClient = new QueryClient(); export default { title: "TopologyCard", component: TopologyCard, parameters: { actions: { argTypesRegex: "^on.*" } }, - decorators: [ - (Story) => ( - - - - - - ) - ] + decorators: [(Story) => ] } as ComponentMeta; const topology: Topology = { diff --git a/src/ui/BreadcrumbNav/BreadcrumbNav.stories.tsx b/src/ui/BreadcrumbNav/BreadcrumbNav.stories.tsx index af3374724..e4c1a24fe 100644 --- a/src/ui/BreadcrumbNav/BreadcrumbNav.stories.tsx +++ b/src/ui/BreadcrumbNav/BreadcrumbNav.stories.tsx @@ -1,19 +1,11 @@ -import { MemoryRouter } from "react-router-dom"; - +import { ComponentMeta, ComponentStory } from "@storybook/react"; import { AiFillPlusCircle } from "react-icons/ai/"; import { BreadcrumbNav } from "./index"; -import { ComponentMeta, ComponentStory } from "@storybook/react"; export default { title: "BreadcrumbNav", component: BreadcrumbNav, - decorators: [ - (Story) => ( - - - - ) - ] + decorators: [(Story) => ] } as ComponentMeta; const Template: ComponentStory = (arg) => ( diff --git a/src/ui/DataTable/DataTable.stories.tsx b/src/ui/DataTable/DataTable.stories.tsx index 075a8b2a5..6316fde6f 100644 --- a/src/ui/DataTable/DataTable.stories.tsx +++ b/src/ui/DataTable/DataTable.stories.tsx @@ -1,6 +1,5 @@ import { ComponentMeta, ComponentStory } from "@storybook/react"; import React from "react"; -import { MemoryRouter } from "react-router-dom"; import { DataTable } from "./index"; import { ColumnDef } from "@tanstack/react-table"; @@ -51,13 +50,7 @@ const defaultTableColumns: ColumnDef[] = [ export default { title: "DataTable", component: DataTable, - decorators: [ - (Story: React.FC) => ( - - - - ) - ] + decorators: [(Story: React.FC) => ] } as ComponentMeta; const configData = [ diff --git a/src/ui/DataTable/FilterByCell.stories.tsx b/src/ui/DataTable/FilterByCell.stories.tsx index 37bbf4b1a..febad9316 100644 --- a/src/ui/DataTable/FilterByCell.stories.tsx +++ b/src/ui/DataTable/FilterByCell.stories.tsx @@ -1,6 +1,6 @@ import { Meta, StoryFn } from "@storybook/react"; import React from "react"; -import { MemoryRouter, useSearchParams } from "react-router-dom"; +import { useSearchParams } from "react-router-dom"; import { JSONViewer } from "../Code/JSONViewer"; import FilterByCellValue from "./FilterByCellValue"; @@ -8,13 +8,7 @@ import FilterByCellValue from "./FilterByCellValue"; export default { title: "FilterByCellValue", component: FilterByCellValue, - decorators: [ - (Story: React.FC) => ( - - - - ) - ] + decorators: [(Story: React.FC) => ] } satisfies Meta; const Template: StoryFn = (arg) => { diff --git a/src/ui/TimeRangePicker/TimeRangePicker.stories.tsx b/src/ui/TimeRangePicker/TimeRangePicker.stories.tsx index 72d8036dc..2c5647f88 100644 --- a/src/ui/TimeRangePicker/TimeRangePicker.stories.tsx +++ b/src/ui/TimeRangePicker/TimeRangePicker.stories.tsx @@ -1,5 +1,4 @@ import { ComponentMeta, ComponentStory } from "@storybook/react"; -import { MemoryRouter } from "react-router-dom"; import { TimeRangePicker } from "./index"; import { TimeRangeOption } from "./rangeOptions"; @@ -16,9 +15,7 @@ export default { } as ComponentMeta; const Template: ComponentStory = () => ( - - - + ); export const Primary = Template.bind({});