-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1babf74
commit c0c8fcd
Showing
9 changed files
with
70 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import { EmptyState } from "./EmptyState"; | ||
|
||
export default { | ||
title: "Components/EmptyState", | ||
component: EmptyState, | ||
} as Meta; | ||
|
||
type Story = StoryObj<typeof EmptyState>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
titleSlot: "Create your first Spark.", | ||
textSlot: | ||
"Sparks can be of any topic. Use #tags to structure your Sparks. #tags added to the beginning of a Spark are used as context. Try adding your first one.", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import "@testing-library/jest-dom"; | ||
import { render, screen } from "@testing-library/react"; | ||
import { EmptyState } from "./EmptyState"; | ||
import { describe, it } from "vitest"; | ||
|
||
describe("EmptyState", () => { | ||
it("should render", () => { | ||
render( | ||
<EmptyState | ||
titleSlot="Hello world" | ||
textSlot="How are you?" | ||
/>, | ||
); | ||
|
||
expect(screen.getByText("Hello world")).toBeInTheDocument(); | ||
expect(screen.getByText("How are you?")).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type React from "react"; | ||
|
||
export type EmptyStateProps = { | ||
titleSlot: React.ReactNode; | ||
textSlot: React.ReactNode; | ||
}; | ||
|
||
export const EmptyState = (props: EmptyStateProps) => { | ||
const { titleSlot, textSlot } = props; | ||
return ( | ||
<div className="flex flex-col gap-4 p-4 text-center"> | ||
<span className="font-bold text-lg text-stone-700"> | ||
{titleSlot} | ||
</span> | ||
<span className="text-stone-500">{textSlot}</span> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters