Skip to content
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

Merged
merged 8 commits into from
Sep 2, 2022
Merged

Conversation

ndelangen
Copy link
Member

  • add generic stories in code/addons/actions/template/stories
  • remove usage of addon-actions where it serves no purpose anymore

@ndelangen ndelangen self-assigned this Sep 1, 2022
@ndelangen ndelangen added maintenance User-facing maintenance tasks addon: actions labels Sep 1, 2022
@ndelangen ndelangen requested review from tmeasday and shilman and removed request for tmeasday September 1, 2022 19:14
Copy link
Member

@tmeasday tmeasday left a 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');
Copy link
Member

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?

Copy link
Member Author

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:

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.

Copy link
Member

@shilman shilman left a 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?

@tmeasday
Copy link
Member

tmeasday commented Sep 2, 2022

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

@ndelangen
Copy link
Member Author

Where is this code?

I think the template stories are allowed to be TS as they are processed by esbuild-loader.

@tmeasday

@shilman shilman changed the title move addon-actions' stories into addons/actions/template/stories Examples: Move addon-actions stories into addon Sep 2, 2022
@shilman shilman changed the title Examples: Move addon-actions stories into addon Addon-actions: Move stories into addon Sep 2, 2022
@shilman shilman merged commit 78391bc into next Sep 2, 2022
@shilman shilman deleted the norbert/sb-573-addon-actions branch September 2, 2022 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addon: actions maintenance User-facing maintenance tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants