-
-
Notifications
You must be signed in to change notification settings - Fork 521
docs: Swap out "GitHub Stars" homepage demo for "GitHub Repos" #1321
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
Conversation
e8bf48c
to
8546f8c
Compare
4801ebe
to
a527be6
Compare
fetch(`${SEARCH}?q=preact`) | ||
.then(res => res.json()) | ||
.then(data => setItems((data && data.items) || [])); | ||
fetch(`https://api.github.com/orgs/${org}/repos?per_page=50`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example has been altered to only return repositories from our organization rather than any repo with "preact" in the name or description; whilst there's nothing problematic in the data at this time, that could potentially change and as such it's a bit safer to only include a known data set.
code({ text, lang }) { | ||
const rawCodeBlockText = text.trim().replace('<br>', '\n'); | ||
const [code, source, runInRepl] = processRepl(rawCodeBlockText); | ||
const [code, source, runInRepl] = processRepl(text.trim()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This now only includes "true" code blocks in markdown, i.e., those fenced with backticks. In those blocks, we have no reason to use <br>
, so this was redudant. A confusing sort of redundant though, as I was wondering why it wasn't working for the examples on the home page when I altered it.
Leftover & unused fragment from #1205.
<pre repl="false"><code class="language-jsx"> | ||
import TodoList from './todo-list';<br> | ||
render(<TodoList />, document.body); | ||
import TodoList from './todo-list';<br> | ||
render(<TodoList />, document.body); | ||
</code></pre> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another "should've probably addressed in #1205". As marked
no longer handles these code blocks, we don't need the entity encoding & can use dedent
to get less gross indentation.
Still need to sprinkle <br>
everywhere but not a whole heck of a lot can be done there.
"node_modules/@jridgewell/source-map": { | ||
"version": "0.3.5", | ||
"resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.5.tgz", | ||
"integrity": "sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ==", | ||
"optional": true, | ||
"peer": true, | ||
"dependencies": { | ||
"@jridgewell/gen-mapping": "^0.3.0", | ||
"@jridgewell/trace-mapping": "^0.3.9" | ||
} | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think most of this comes from #1280? Not too sure, just wanted to mention it as I made sure this didn't come from any local changes I made.
@@ -187,36 +189,69 @@ render(<ToDoList />, document.body); | |||
<div> | |||
<h3>Zeige GitHub-Stars</h3> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translations mostly hold (we're still displaying stars for repos on GitHub) so I'm not too concerned with the existing labels
'Cache-Control': 'public, max-age=3600, stale-if-error=86400' | ||
'Cache-Control': 'public, max-age=86400, stale-if-error=86400' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bumped the cache age here as we're not releasing anywhere near often enough for an hour-long cache to really be justified.
43dbcea
to
466d207
Compare
The 'GitHub Stars' example we have on the bottom of the home page is not great, IMO, as it's calling an external & hidden function in
componentDidMount
. Doesn't show much beyond that you can update state after mount to display some data, and even if we moved in the fetch call, it's a bit plain.This PR swaps that out with a slightly altered version of our 'GitHub Repos' example from the REPL which showcases a similar situation (fetching external data & consuming it) but does so transparently and slightly more interestingly.