Reorganize repo structure and standards references
This commit is contained in:
1 parent
3cb93a81be
commit
be2054274d
5885 files changed
+2588
-195
No files matched your search
+85
@@ -0,0 +1,85 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react";
|
||||
import { DemoButton } from "./_demo-primitives.js";
|
||||
|
||||
const meta: Meta = {
|
||||
title: "UI / Feedback / EmptyState",
|
||||
};
|
||||
|
||||
export default meta;
|
||||
|
||||
type Story = StoryObj;
|
||||
|
||||
function EmptyState({
|
||||
title,
|
||||
body,
|
||||
action,
|
||||
illustration,
|
||||
}: {
|
||||
title: string;
|
||||
body: string;
|
||||
action?: React.ReactNode;
|
||||
illustration?: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<div
|
||||
role="status"
|
||||
style={{
|
||||
border: "1px dashed var(--color-border)",
|
||||
borderRadius: 8,
|
||||
padding: 32,
|
||||
textAlign: "center",
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
gap: 12,
|
||||
maxWidth: 420,
|
||||
color: "var(--color-muted)",
|
||||
}}
|
||||
>
|
||||
{illustration}
|
||||
<h3 style={{ margin: 0, fontSize: 18, color: "var(--color-fg)" }}>{title}</h3>
|
||||
<p style={{ margin: 0, fontSize: 14 }}>{body}</p>
|
||||
{action}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const Inbox = () => (
|
||||
<svg width="56" height="56" viewBox="0 0 56 56" aria-hidden focusable="false">
|
||||
<rect x="6" y="14" width="44" height="32" rx="4" fill="var(--color-accent)" />
|
||||
<path d="M6 28 H20 L24 34 H32 L36 28 H50" stroke="var(--color-fg)" strokeWidth="2" fill="none" />
|
||||
</svg>
|
||||
);
|
||||
|
||||
export const NoData: Story = {
|
||||
name: "No data",
|
||||
render: () => (
|
||||
<EmptyState
|
||||
illustration={<Inbox />}
|
||||
title="No projects yet"
|
||||
body="Create your first project to start collaborating with your team."
|
||||
action={<DemoButton>Create project</DemoButton>}
|
||||
/>
|
||||
),
|
||||
};
|
||||
|
||||
export const NoResults: Story = {
|
||||
name: "No search results",
|
||||
render: () => (
|
||||
<EmptyState
|
||||
title="No matches for your search"
|
||||
body="Try a different keyword or clear the filters to see all items."
|
||||
/>
|
||||
),
|
||||
};
|
||||
|
||||
export const ErrorState: Story = {
|
||||
name: "Error state",
|
||||
render: () => (
|
||||
<EmptyState
|
||||
title="Something went wrong"
|
||||
body="We could not load the dashboard. Please try again in a moment."
|
||||
action={<DemoButton variant="outline">Retry</DemoButton>}
|
||||
/>
|
||||
),
|
||||
};
|
||||
Reference in new issue
Block a user