forked from PrefectHQ/prefect
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathflow-icon-text.stories.tsx
More file actions
66 lines (60 loc) · 1.46 KB
/
flow-icon-text.stories.tsx
File metadata and controls
66 lines (60 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import type { Meta, StoryObj } from "@storybook/react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import {
createMemoryHistory,
createRootRoute,
createRouter,
RouterProvider,
} from "@tanstack/react-router";
import { Suspense } from "react";
import { FlowIconText } from "./flow-icon-text";
const queryClient = new QueryClient({
defaultOptions: {
queries: {
retry: false,
},
},
});
const createTestRouter = (flowId: string) => {
const rootRoute = createRootRoute({
component: () => (
<Suspense fallback={<div>Loading...</div>}>
<FlowIconText flowId={flowId} />
</Suspense>
),
});
return createRouter({
routeTree: rootRoute,
history: createMemoryHistory({ initialEntries: ["/"] }),
context: { queryClient: new QueryClient() },
});
};
const meta: Meta<typeof FlowIconText> = {
title: "Components/Flows/FlowIconText",
component: FlowIconText,
decorators: [
(_Story, context) => {
const router = createTestRouter(context.args.flowId ?? "flow-123");
return (
<QueryClientProvider client={queryClient}>
<RouterProvider router={router} />
</QueryClientProvider>
);
},
],
parameters: {
docs: {
description: {
component:
"A link component that fetches and displays a flow name with a Workflow icon, linking to the flow detail page.",
},
},
},
};
export default meta;
type Story = StoryObj<typeof FlowIconText>;
export const Default: Story = {
args: {
flowId: "flow-123",
},
};