diff --git a/ui-v2/.gitignore b/ui-v2/.gitignore index 06d4ee4fe877..196b52fa1867 100644 --- a/ui-v2/.gitignore +++ b/ui-v2/.gitignore @@ -28,3 +28,4 @@ dist-ssr oss_schema.json *.tsbuildinfo *storybook.log +*.orig diff --git a/ui-v2/src/components/ui/empty-state.stories.tsx b/ui-v2/src/components/ui/empty-state.stories.tsx new file mode 100644 index 000000000000..d28e25207df1 --- /dev/null +++ b/ui-v2/src/components/ui/empty-state.stories.tsx @@ -0,0 +1,49 @@ +import type { Meta, StoryObj } from "@storybook/react"; + +import { PlusIcon } from "lucide-react"; +import { Button } from "./button"; +import { DocsLink } from "./docs-link"; +import { + EmptyState, + EmptyStateActions, + EmptyStateDescription, + EmptyStateIcon, + EmptyStateTitle, +} from "./empty-state"; + +const meta: Meta = { + title: "UI/EmptyState", + component: EmptyState, + parameters: { + docs: { + description: { + component: + "EmptyState is used to prompt to user to create a resource when there is none", + }, + }, + }, +}; +export default meta; + +type Story = StoryObj; +export const Usage: Story = { + render: () => , +}; + +function EmptyStateExample(): JSX.Element { + return ( + + + Add a variable to get started + + Variables store non-sensitive pieces of JSON. + + + + + + + ); +} diff --git a/ui-v2/src/components/ui/empty-state.tsx b/ui-v2/src/components/ui/empty-state.tsx new file mode 100644 index 000000000000..50104fb483ca --- /dev/null +++ b/ui-v2/src/components/ui/empty-state.tsx @@ -0,0 +1,43 @@ +import { Card, CardContent } from "@/components/ui/card"; +import { icons } from "lucide-react"; + +const EmptyStateIcon = ({ id }: { id: keyof typeof icons }): JSX.Element => { + const LucideIcon = icons[id]; + return ; +}; +const EmptyStateTitle = ({ + children, +}: { children: React.ReactNode }): JSX.Element => ( +

{children}

+); + +const EmptyStateDescription = ({ + children, +}: { children: React.ReactNode }): JSX.Element => ( +

{children}

+); + +const EmptyStateActions = ({ + children, +}: { children: React.ReactNode }): JSX.Element => ( +
{children}
+); + +type Props = { + children: React.ReactNode; +}; +const EmptyState = ({ children }: Props): JSX.Element => ( + + + {children} + + +); + +export { + EmptyState, + EmptyStateIcon, + EmptyStateTitle, + EmptyStateDescription, + EmptyStateActions, +}; diff --git a/ui-v2/src/components/variables/empty-state.tsx b/ui-v2/src/components/variables/empty-state.tsx index 98760903443b..123c52348cf9 100644 --- a/ui-v2/src/components/variables/empty-state.tsx +++ b/ui-v2/src/components/variables/empty-state.tsx @@ -1,7 +1,13 @@ import { Button } from "@/components/ui/button"; -import { Card, CardContent } from "@/components/ui/card"; import { DocsLink } from "@/components/ui/docs-link"; -import { PlusIcon, VariableIcon } from "lucide-react"; +import { + EmptyState, + EmptyStateActions, + EmptyStateDescription, + EmptyStateIcon, + EmptyStateTitle, +} from "@/components/ui/empty-state"; +import { PlusIcon } from "lucide-react"; type VariablesEmptyStateProps = { onAddVariableClick: () => void; @@ -9,19 +15,17 @@ type VariablesEmptyStateProps = { export const VariablesEmptyState = ({ onAddVariableClick, }: VariablesEmptyStateProps) => ( - - - -

Add a variable to get started

-

- Variables store non-sensitive pieces of JSON. -

-
- - -
-
-
+ + + Add a variable to get started + + Variables store non-sensitive pieces of JSON. + + + + + + );