[Docs]: Add missing constants in React Aria > Examples > Contact List
Hello, this PR is not related to any existing issue, but I was trying to use the example code presented here: Contact List and noticed that the variables favorites and people are hidden in the code snippet.
This PR is to reveal those hidden variables in the code snippet explicitly, as to avoid user confusion.
Screenshot (before)
Screenshot (after)
✅ Pull Request Checklist:
- [ ] Included link to corresponding React Spectrum GitHub Issue.
- [ ] Added/updated unit tests and storybook for this change (for new code or code which already has tests).
- [x] Filled out test instructions.
- [ ] Updated documentation (if it already exists for this component).
- [ ] Looked at the Accessibility Practices for this feature - Aria Practices
📝 Test Instructions:
-
git clone <this PR> -
yarn start:docs - Go to http://localhost:1234/react-aria/examples/contact-list.html and check the code snippet.
🧢 Your Project:
IMO we need to hide them to keep the example code to a reasonable length. Maybe we can put in a collapsed section but I didn't think anyone would really want our fake content...
@devongovett I get that revealing the data can be very distracting especially when placed at the top. But at the same time, wouldn't users expect the example code to just work when copied and pasted? (I know I would 😅).
Anyways, I like the idea of making them collapsible.
These look quite nice to me:
Gonna close this one for now. In our upcoming docs update we will have the ability to create collapsed code sections like that more easily. We will revisit then.