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

fix(docs): Add how to reset state to docs/guides section #1236

Merged
merged 6 commits into from Aug 29, 2022
Merged

fix(docs): Add how to reset state to docs/guides section #1236

merged 6 commits into from Aug 29, 2022

Conversation

dbritto-dev
Copy link
Collaborator

Related Issues

Fixes #1008

Summary

Move how to reset state to ./docs

Check List

  • yarn run prettier for formatting code and docs

@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 29, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 8bc6fc0:

Sandbox Source
React Configuration
React Typescript Configuration
React Browserify Configuration
React Snowpack Configuration
React Parcel Configuration

@dai-shi dai-shi changed the title Add how to reset state to docs/guides section fix(docs): Add how to reset state to docs/guides section Aug 29, 2022
Copy link
Member

@dai-shi dai-shi left a comment

Choose a reason for hiding this comment

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

Would you create a codesandbox example and add a link?

docs/guides/how-to-reset-state.md Outdated Show resolved Hide resolved
@dbritto-dev
Copy link
Collaborator Author

@dai-shi how I can do that?. BTW, there's a way to see the docs locally?

@dai-shi
Copy link
Member

dai-shi commented Aug 29, 2022

Just create a codesandbox with https://react.ts.new and copy&paste the code, and see if it's working.

No, I don't think there is such a way.

@dbritto-dev
Copy link
Collaborator Author

@dai-shi
Copy link
Member

dai-shi commented Aug 29, 2022

@dai-shi here's the demo -> https://codesandbox.io/s/wispy-mountain-gtu0qe?file=/src/App.tsx

Cool. Please put it in the md file.

If you can, try to make the demo a little more fancy by showing both "salmon" and "tuna" counts and adding three buttons (addSalmon, addTuna, reset).

@dbritto-dev
Copy link
Collaborator Author

@dai-shi sure I'll do it tomorrow. I'll add the codesandbox to the md and I'll update the codesandox to show both.

@chrisk-7777
Copy link
Collaborator

chrisk-7777 commented Aug 29, 2022

I've been able to run locally (well kind of locally) by doing the following:

  • Clone https://github.com/pmndrs/website/
  • Separately have Zustand cloned (where you're doing the doc work)
  • In the website alter this file src/data/libraries.ts to include your repo (see below for example)
  • Create a temp branch (for example temp-docs) on your own fork
  • Make changes and push to this temp branch (I just kept rebasing on the top, either way you can delete the branch afterwards)
  • Then run the site yarn run dev

Temporary change just while working locally

  zustand: {
    title: 'Zustand',
    url: '/zustand',
    github: 'https://github.com/pmndrs/zustand',
    description: '...',
    icon: zustandIcon.src,
    image: zustandShare.src,
    docs: 'chrisk-7777/zustand/temp-docs/docs', // <-- this line is key
  },

The docs path is:

  • chrisk-7777 your github name (or org)
  • zustand (leave as is)
  • temp-docs your temporary branch name
  • docs leave as is

@dbritto-dev
Copy link
Collaborator Author

@chrisk-7777 cool, good to know. I'll work on that later to make it simple (just one command).

Copy link
Member

@dai-shi dai-shi left a comment

Choose a reason for hiding this comment

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

hmm, tbh, I prefer the codesandbox example for basic usage, not with slices. Sorry if my comment was confusing. You don't need to remove the current example, but add a new one. You can just have two codesandbox links in the doc.

@dbritto-dev
Copy link
Collaborator Author

@dai-shi yeah I was thinking on that. I can create two codesandbox if that's ok.

Copy link
Member

@dai-shi dai-shi left a comment

Choose a reason for hiding this comment

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

LGTM!

@dai-shi dai-shi merged commit 0eee59e into pmndrs:main Aug 29, 2022
@dbritto-dev dbritto-dev deleted the docs/how-to-reset-state branch August 29, 2022 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move the docs from Github's wiki to the ./docs directory
3 participants