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

Chore: add snippets for api section #11877

Merged
merged 3 commits into from
Aug 11, 2020
Merged

Conversation

jonniebigodes
Copy link
Contributor

@jonniebigodes jonniebigodes commented Aug 11, 2020

With this pull request the snippets required for the api section are included and the markdown files are now adjusted to reflect the changes:

What was done:

  • Updated the markdown files to include the snippets based on the file naming and structure decided.
  • Created the snippets.

Feel free to provide feedback

@domyen
Copy link
Member

domyen commented Aug 11, 2020

lgtm! 👏

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, a few minor changes


<!--- Badge.stories.mdx --->

<!--- This is your Story template function, shown here in React -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think maybe you misunderstood my meaning in including these comments. I was referring to the MDX files where there is a single line:

<!--- This is your Story template function, shown here in React -->
export const Template = (args) => <Button {...args} />

<Story name="X" args={{bla}} >
  {Template.bind({})}
</Story>

In such cases that line (export const Template ...) is the single thing that would be different between a react + angular version of the MDX snippet.

However in many of these examples there are large snippets of react-specific code and so I think they should "react" snippets. (Actually in this actual example I think we should maybe rewrite the snippet to use args, but in other examples they need to remain "react-ized").

Comment on lines 10 to 11
export const Basic = () => <MyComponent />;
export const WithProp = () => <MyComponent prop="value" />;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this react code?

Comment on lines 4 to 10
import { useParameter } from '@storybook/api';
const PARAM_KEY = 'myAddon';
const MyPanel = () => {
const value = useParameter(PARAM_KEY, null);
const item = value ? value.data : '';
return <div>{item}</div>;
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This snippet is common -- not react specific (manager code is always react).

Comment on lines 4 to 11
addons.register(ADDON_ID, () => {
addons.add(PANEL_ID, {
type: types.PANEL,
title: 'My Addon',
render: () => <div>Addon tab content</div>,
paramKey: 'myAddon', // this element
});
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This snippet is common -- not react specific (manager code is always react).

Comment on lines 4 to 23
import React from 'react';
import { addons, types } from '@storybook/addons';
import { AddonPanel } from '@storybook/components';

const ADDON_ID = 'myaddon';
const PANEL_ID = `${ADDON_ID}/panel`;

// give a unique name for the panel
const MyPanel = () => <div>MyAddon</div>;
addons.register(ADDON_ID, (api) => {
addons.add(PANEL_ID, {
type: types.PANEL,
title: 'My Addon',
render: ({ active, key }) => (
<AddonPanel active={active} key={key}>
<MyPanel />
</AddonPanel>
),
});
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This snippet is common -- not react specific (manager code is always react).

@jonniebigodes
Copy link
Contributor Author

@tmeasday with the latest commit i addressed the feedback you mentioned.

Let me know if you need anything else.

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.

LGTM

@jonniebigodes
Copy link
Contributor Author

conflicts are solved, let me know if you need anything else.

@shilman shilman merged commit 30d685c into next Aug 11, 2020
@stof stof deleted the chore_add_api_section_snippets branch May 25, 2022 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants