-
-
Notifications
You must be signed in to change notification settings - Fork 949
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
Add refresh button to the api docs examples #3287
Comments
FFR: The preview in the video was created using this code:<button style="border: none; background: none; cursor: pointer;" onclick="
var lines = this.nextElementSibling.children[0].children[2].children[0].children;
lines[0].children[3].innerText = '// '+JSON.stringify(faker.lorem.sentences());
lines[1].children[5].innerText = '// '+JSON.stringify(faker.lorem.sentences(2));
const parts = JSON.stringify(faker.lorem.sentences(2, '\n')).split('\\n');
lines[3].children[0].innerText = '// '+parts[0];
lines[4].children[0].innerText = '// '+parts[1];
lines[5].children[7].innerText = '// '+JSON.stringify(faker.lorem.sentences({ min: 1, max: 3 }));
">
<img src="https://upload.wikimedia.org/wikipedia/commons/c/ce/Ic_refresh_48px.svg" alt="Refresh Icon" width="24" height="24" style="display: inline-block; vertical-align: middle;">
</button> The actual code should be more dynamic, so that it works without any configuration (and use a different svg). The
No additional libraries needed. |
What do you think of this idea? |
Speaking as the author of the original issue, I think it's great idea. |
Team Decision
|
I think rather than just an icon it could be a smal button in the bottom right of the examples block like "Load more examples" |
Replace like in your video. |
Clear and concise description of the problem
Currently, the documentation only provides a single example per invocation, this could result in wrong expectations of method return values.
See:
faker.phone.number()
is returned differently than in the documentation. #3283Suggested solution
Adding a refresh button to the example sections:
apidocs-refresh-button.mp4
For that to work, we have to
() => unknown[]
to the export data from the actual examplesAlternative
Add more examples for the no args examples.
Additional context
Original issue:
faker.phone.number()
is returned differently than in the documentation. #3283Original fix suggestion:
Alternative suggestion for a fix:
The text was updated successfully, but these errors were encountered: