I can't understand why I'm receiving this error Property 'args' does not exist on type (args: Props) => Element
I'm trying to add args to my Storybook component. This is how my .stories.tsx file looks like
import React from "react";
import { Story, Meta } from "@storybook/react";
import { Props, Button } from ".";
export default {
title: "General/Button",
component: Button
} as Meta;
const Template = (args: Props) => <Button {...args} />;
export const PrimaryA = Template.bind({});
PrimaryA.args = { <-- ERROR
variant: "primary"
};
And simple .tsx file of Button component
import { css } from "@emotion/react";
import React from "react";
export interface Props {
args: {
variant: string;
children?: React.ReactNode;
},
}
const style = css`
.primary {
background: #0082ff;
border-radius: 8px;
width: 150px;
height: 50px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
`;
export function Button(props: Props) {
const { variant = "primary", children = "Primary", ...rest } = props.args;
return (
<div css={style} className={`button ${variant}`} {...rest}>
{children}
</div>
);
}
How you can see I have there is already .args property in the interface Props. I have no idea how to fix it. Thanks :))
Edit.
I edited interface
export interface Props {
variant: string;
children?: React.ReactNode;
}
As well as PrimaryA object
const Template = (props: Props) => <Button {...props} />;
export const PrimaryA = Template({
variant: "disabled"
});
And still nothing. I can't see component at the Storybook