Skip to content

Commit

Permalink
chore: improve the story template (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadshaheer authored Oct 3, 2024
1 parent 9e845e4 commit 29360f0
Showing 1 changed file with 26 additions and 9 deletions.
35 changes: 26 additions & 9 deletions turbo/generators/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,19 +213,36 @@ export default function generator(plop: PlopTypes.NodePlopAPI): void {
`apps/docs/stories/${(answers as { name: string }).name}.stories.tsx`
);
const storyContent = `
import React from 'react';
import { Story, Meta } from '@storybook/react';
import type { Meta, StoryObj } from "@storybook/react";
export default {
const ExampleComponent = ({ text = "Example Component" }) => <h1>{text}</h1>;
const meta: Meta<typeof ExampleComponent> = {
title: 'Components/${(answers as { name: string }).name.charAt(0).toUpperCase() + (answers as { name: string }).name.slice(1)}',
component: () => <h1>Component goes here</h1>,
} as Meta;
component: ExampleComponent,
argTypes: {
text: {
control: { type: "text" },
},
},
};
export default meta;
const Template: Story = () => <h1>Component goes here</h1>;
type Story = StoryObj<typeof ExampleComponent>;
export const Default: Story = {
render: (args) => <ExampleComponent {...args} />,
args: {
text: "Default Example",
},
};
export const Default = Template.bind({});
Default.args = {
// Add default props here
export const CustomText: Story = {
render: (args) => <ExampleComponent {...args} />,
args: {
text: "Custom Example Text",
},
};
`;

Expand Down

0 comments on commit 29360f0

Please sign in to comment.