-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Addon-actions: Move stories into addon #19082
Conversation
…here where it serves no further purpose
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good except I think a couple things are missing?
onClick: (e) => { | ||
console.log(e); | ||
e.preventDefault(); | ||
action('Action name')(e.target, 'Another arg'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have an example of using an action inline?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an action inline? I'm not sure I understand..
Do you mean like this:
storybook/code/addons/actions/template/stories/basics.stories.js
Lines 19 to 66 in 802f349
export const TypeString = { | |
args: { onClick: () => action('onClick')('string') }, | |
}; | |
export const TypeBoolean = { | |
args: { onClick: () => action('onClick')(false) }, | |
}; | |
export const TypeObject = { | |
args: { onClick: () => action('onClick')({}) }, | |
}; | |
export const TypeNull = { | |
args: { onClick: () => action('onClick')(null) }, | |
}; | |
export const TypeUndefined = { | |
args: { onClick: () => action('onClick')(undefined) }, | |
}; | |
export const TypeNaN = { | |
args: { onClick: () => action('onClick')(NaN) }, | |
}; | |
export const TypeInfinity = { | |
args: { onClick: () => action('onClick')(Infinity) }, | |
}; | |
export const TypeMinusInfinity = { | |
args: { onClick: () => action('onClick')(-Infinity) }, | |
}; | |
export const TypeNumber = { | |
args: { onClick: () => action('onClick')(10000) }, | |
}; | |
export const TypeGlobal = { | |
args: { onClick: () => action('onClick')(globalThis) }, | |
}; | |
export const TypeSymbol = { | |
args: { onClick: () => action('onClick')(Symbol('MySymbol')) }, | |
}; | |
export const TypeRegExp = { | |
args: { onClick: () => action('onClick')(new RegExp('MyRegExp')) }, | |
}; | |
export const TypeArray = { | |
args: { onClick: () => action('onClick')(['a', 'b', 'c']) }, | |
}; | |
export const TypeClass = { | |
args: { onClick: () => action('onClick')(class MyClass {}) }, | |
}; | |
export const TypeFunction = { | |
args: { onClick: () => action('onClick')(function MyFunction() {}) }, | |
}; | |
export const TypeMultiple = { | |
args: { onClick: () => action('onClick')('string', true, false, null, undefined, [], {}) }, | |
}; |
I can't do anything in a render function, in these stories, because that would make them framework specific.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think all the template stories need to be stories.js
files so that they can be embedded in JS-only files. @tmeasday can you please confirm?
I think the template stories are allowed to be TS as they are processed by esbuild-loader. The component files defined by the renderer need to be basic least common denominator JS(X) for that renderer |
Where is this code?
|
code/addons/actions/template/stories