Skip to content

Commit

Permalink
Add storybook (#16398)
Browse files Browse the repository at this point in the history
  • Loading branch information
edmundito authored Sep 7, 2022
1 parent 479c232 commit fbeb6a4
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const CloseButton = styled(Button)`
margin-left: 10px;
`;

const SingletonCard: React.FC<SingletonCardProps> = (props) => (
export const SingletonCard: React.FC<SingletonCardProps> = (props) => (
<Singleton hasError={props.hasError}>
{props.hasError && <ErrorSign />}
<div>
Expand Down
35 changes: 35 additions & 0 deletions airbyte-webapp/src/components/SingletonCard/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { ComponentStory, ComponentMeta } from "@storybook/react";

import { SingletonCard } from "./SingletonCard";

export default {
title: "Ui/SingletonCard",
component: SingletonCard,
argTypes: {
title: { type: { name: "string", required: false } },
text: { type: { name: "string", required: false } },
onClose: { table: { disable: true } },
},
} as ComponentMeta<typeof SingletonCard>;

const Template: ComponentStory<typeof SingletonCard> = (args) => <SingletonCard {...args} />;

export const Basic = Template.bind({});
Basic.args = {
text: "This is a basic card",
};

export const WithTitle = Template.bind({});
WithTitle.args = {
title: "With Title",
text: "This is a card with a title",
};

export const WithCloseButton = Template.bind({});
WithCloseButton.args = {
title: "With Close button",
text: "This is a card with a close button",
onClose: () => {
console.log("Closed!");
},
};

0 comments on commit fbeb6a4

Please sign in to comment.