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

docs: add default stories for IDE components #2398

Merged
merged 7 commits into from
Nov 2, 2023

Conversation

ofhope
Copy link
Contributor

@ofhope ofhope commented Sep 8, 2023

Changes:

Adds default stories to IDE components. At least to the ones that make sense. There are a few like Toast, Timer and EditorAccessibility which is either hidden or needs some redux magic set up to trigger output.

There is more that could be done for each story to offer any other variations. But for a first pass I think it's good to get a simple story. I think would ease development for things like file upload or copyable field as they are now surfaced as an isolated story.

Screenshot 2023-09-08 at 1 48 27 pm Screenshot 2023-09-08 at 1 48 18 pm Screenshot 2023-09-08 at 1 47 56 pm Screenshot 2023-09-08 at 1 47 29 pm Screenshot 2023-09-08 at 1 47 24 pm

I have verified that this pull request:

  • has no linting errors (npm run lint)
  • has no test errors (npm run test)
  • is from a uniquely-named feature branch and is up to date with the develop branch.
  • is descriptively named and links to an issue number, i.e. Fixes #123

lindapaiste
lindapaiste previously approved these changes Sep 14, 2023
Copy link
Collaborator

@lindapaiste lindapaiste left a comment

Choose a reason for hiding this comment

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

Excellent work 👍 You've got me thinking about lots of things and I've added many comments with things that we can improve in the future.

The biggest thing is how these components interact with Redux. We have two approaches here to make these stories make sense:

  1. Each component exports a connected version which gets the state from Redux and an unconnected version which accepts props. We would use the unconnected version for Storybook. This is easy for the old components which use connect. But for the ones that I've rewritten, like Timer, I've generally been making it so that the component takes no props and accesses Redux internally.

  2. We pass the args of the story into a Redux provider so that we can specify the correct state. This requires setup and more work on the Storybook side, but no changes to the components which is a pro. But it also requires the story to know the structure of the Redux state, ie. that projectSavedTime should go in state.project.updatedAt, and that is a con to me because Redux should be a black box.

url: 'https://p5js.org/assets/img/p5js.svg',
name: 'P5 Logo'
}
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can add stories for audio and video files (can be done later).


export const Default = {
args: {
totalSize: 123
Copy link
Collaborator

Choose a reason for hiding this comment

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

This story shows up with a control for the totalSize, but changing it doesn't do anything because the default export gets the size from Redux.

Once we get the styles working and once we get this using the args then it might be cool to have stories for empty vs. full vs. somewhere in the middle.

value: 'an@email.com',
label: 'Example'
}
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

We aren't seeing the pencil icon here due to an issue with svgr. I think it's removing the viewbox. Just FYI, we can fix that later.

component: NewFileForm
};

export const Default = {};
Copy link
Collaborator

Choose a reason for hiding this comment

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

The NewFileForm is only used inside of the NewFileModal so it might be redundant to have stories for both. (the same for the NerFolderForm)

TBH we could consider combing the two component files as there's not much left in the NewFileModal after we made a common Modal component.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like the idea of having fewer Modals and reusing the generic one. I think thats capturing the layout primitives

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've removed NerFolderForm

Comment on lines +16 to +23
sketches: [
{
id: '1',
name: 'Play Sketch',
createdAt: Date.now().toString(),
updatedAt: Date.now().toString()
}
]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I was wondering why these sketches don't show up in the list. Again, it's because the component ignores this prop and gets the actual value from Redux.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahhh! I was wondering that myself but was unsure.

@lindapaiste lindapaiste added the Area: Documentation For developer documentation related to the p5.js web editor label Sep 14, 2023
@ofhope
Copy link
Contributor Author

ofhope commented Oct 17, 2023

@lindapaiste is there anything here you'd like me to action? I think the comments are follow up items.

Copy link
Collaborator

@lindapaiste lindapaiste left a comment

Choose a reason for hiding this comment

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

Sorry that this was sitting for so long! I'm going to approve and merge this because it is a huge step forwards. We can continue to workout some of the kinks with future PRs.

@lindapaiste lindapaiste merged commit 9e463df into processing:develop Nov 2, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Documentation For developer documentation related to the p5.js web editor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants