Skip to content

Commit

Permalink
examples: fix invalid links (#2559)
Browse files Browse the repository at this point in the history
fixing invalid links
  • Loading branch information
fxOne committed Apr 13, 2023
1 parent 17d9ff7 commit 9371f1d
Show file tree
Hide file tree
Showing 18 changed files with 82 additions and 80 deletions.
28 changes: 15 additions & 13 deletions examples/api-hooks/pages/[user]/[repo].js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ export default function Repo() {
const id = typeof window !== 'undefined' ? window.location.pathname.slice(1) : ''
const { data } = useRepository(id)

return <div style={{ textAlign: 'center' }}>
<h1>{id}</h1>
{
data ? <div>
<p>forks: {data.forks_count}</p>
<p>stars: {data.stargazers_count}</p>
<p>watchers: {data.watchers}</p>
</div> : 'loading...'
}
<br />
<br />
<Link href="/"><a>Back</a></Link>
</div>
return (
<div style={{ textAlign: 'center' }}>
<h1>{id}</h1>
{
data ? <div>
<p>forks: {data.forks_count}</p>
<p>stars: {data.stargazers_count}</p>
<p>watchers: {data.watchers}</p>
</div> : 'loading...'
}
<br />
<br />
<Link href="/">Back</Link>
</div>
)
}
20 changes: 11 additions & 9 deletions examples/api-hooks/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ import useProjects from '../hooks/use-projects'
export default function Index() {
const { data } = useProjects()

return <div style={{ textAlign: 'center' }}>
<h1>Trending Projects</h1>
<div>
{
data ? data.map(project =>
<p key={project}><Link href='/[user]/[repo]' as={`/${project}`}><a>{project}</a></Link></p>
) : 'loading...'
}
return (
<div style={{ textAlign: 'center' }}>
<h1>Trending Projects</h1>
<div>
{
data ? data.map(project =>
<p key={project}><Link href='/[user]/[repo]' as={`/${project}`}>{project}</Link></p>
) : 'loading...'
}
</div>
</div>
</div>
)
}
5 changes: 1 addition & 4 deletions examples/axios-typescript/pages/[user]/[repo].tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import Link from 'next/link'

import useRequest from '../../libs/useRequest'
Expand Down Expand Up @@ -29,9 +28,7 @@ export default function Repo() {
)}
<br />
<br />
<Link href="/">
<a>Back</a>
</Link>
<Link href="/">Back</Link>
</div>
)
}
3 changes: 1 addition & 2 deletions examples/axios-typescript/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import Link from 'next/link'

import useRequest from '../libs/useRequest'
Expand All @@ -16,7 +15,7 @@ export default function Index() {
? data.map(project => (
<p key={project}>
<Link href="/[user]/[repo]" as={`/${project}`}>
<a>{project}</a>
{project}
</Link>
</p>
))
Expand Down
2 changes: 1 addition & 1 deletion examples/axios/pages/[user]/[repo].js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function Repo() {
<br />
<br />
<Link href="/">
<a>Back</a>
Back
</Link>
</div>
)
Expand Down
2 changes: 1 addition & 1 deletion examples/axios/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function Index() {
? data.map(project => (
<p key={project}>
<Link href="/[user]/[repo]" as={`/${project}`}>
<a>{project}</a>
{project}
</Link>
</p>
))
Expand Down
5 changes: 1 addition & 4 deletions examples/basic-typescript/pages/[user]/[repo].tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import Link from 'next/link'
import fetch from '../../libs/fetch'

Expand Down Expand Up @@ -27,9 +26,7 @@ export default function Repo() {
)}
<br />
<br />
<Link href="/">
<a>Back</a>
</Link>
<Link href="/">Back</Link>
</div>
)
}
3 changes: 1 addition & 2 deletions examples/basic-typescript/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import Link from 'next/link'
import fetch from '../libs/fetch'

Expand All @@ -17,7 +16,7 @@ export default function HomePage() {
? data.map(project => (
<p key={project}>
<Link href="/[user]/[repo]" as={`/${project}`}>
<a>{project}</a>
{project}
</Link>
</p>
))
Expand Down
28 changes: 15 additions & 13 deletions examples/basic/pages/[user]/[repo].js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@ export default function Repo() {
const id = typeof window !== 'undefined' ? window.location.pathname.slice(1) : ''
const { data } = useSWR('/api/data?id=' + id, fetch)

return <div style={{ textAlign: 'center' }}>
<h1>{id}</h1>
{
data ? <div>
<p>forks: {data.forks_count}</p>
<p>stars: {data.stargazers_count}</p>
<p>watchers: {data.watchers}</p>
</div> : 'loading...'
}
<br />
<br />
<Link href="/"><a>Back</a></Link>
</div>
return (
<div style={{ textAlign: 'center' }}>
<h1>{id}</h1>
{
data ? <div>
<p>forks: {data.forks_count}</p>
<p>stars: {data.stargazers_count}</p>
<p>watchers: {data.watchers}</p>
</div> : 'loading...'
}
<br />
<br />
<Link href="/">Back</Link>
</div>
)
}
20 changes: 11 additions & 9 deletions examples/basic/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ import useSWR from 'swr'
export default function Index() {
const { data } = useSWR('/api/data', fetch)

return <div style={{ textAlign: 'center' }}>
<h1>Trending Projects</h1>
<div>
{
data ? data.map(project =>
<p key={project}><Link href='/[user]/[repo]' as={`/${project}`}><a>{project}</a></Link></p>
) : 'loading...'
}
return (
<div style={{ textAlign: 'center' }}>
<h1>Trending Projects</h1>
<div>
{
data ? data.map(project =>
<p key={project}><Link href='/[user]/[repo]' as={`/${project}`}>{project}</Link></p>
) : 'loading...'
}
</div>
</div>
</div>
)
}
28 changes: 15 additions & 13 deletions examples/global-fetcher/pages/[user]/[repo].js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@ export default function Repo() {
const id = typeof window !== 'undefined' ? window.location.pathname.slice(1) : ''
const { data } = useSWR('/api/data?id=' + id)

return <div style={{ textAlign: 'center' }}>
<h1>{id}</h1>
{
data ? <div>
<p>forks: {data.forks_count}</p>
<p>stars: {data.stargazers_count}</p>
<p>watchers: {data.watchers}</p>
</div> : 'loading...'
}
<br />
<br />
<Link href="/"><a>Back</a></Link>
</div>
return (
<div style={{ textAlign: 'center' }}>
<h1>{id}</h1>
{
data ? <div>
<p>forks: {data.forks_count}</p>
<p>stars: {data.stargazers_count}</p>
<p>watchers: {data.watchers}</p>
</div> : 'loading...'
}
<br />
<br />
<Link href="/">Back</Link>
</div>
)
}
2 changes: 1 addition & 1 deletion examples/global-fetcher/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function Index() {
? data.map(project => (
<p key={project}>
<Link href="/[user]/[repo]" as={`/${project}`}>
<a>{project}</a>
{project}
</Link>
</p>
))
Expand Down
4 changes: 2 additions & 2 deletions examples/prefetch-preload/pages/[user]/[repo].js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import Head from "next/head"
import Link from 'next/link'
import React from 'react'
import fetch from '../../libs/fetch'

import useSWR, { mutate } from 'swr'
Expand Down Expand Up @@ -42,7 +42,7 @@ export default function Repo() {
}
<br />
<br />
<Link href="/"><a onMouseEnter={handleMouseEnter}>Back</a></Link>
<Link href="/" onMouseEnter={handleMouseEnter}>Back</Link>
</div>
</>
)
Expand Down
4 changes: 2 additions & 2 deletions examples/prefetch-preload/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ export default function Index() {
{
data ? data.map(project =>
<p key={project}>
<Link href='/[user]/[repo]' as={`/${project}`}>
<a onMouseEnter={handleMouseEnter}>{project}</a>
<Link href='/[user]/[repo]' as={`/${project}`} onMouseEnter={handleMouseEnter}>
{project}
</Link>
</p>
) : 'loading...'
Expand Down
2 changes: 1 addition & 1 deletion examples/server-render/pages/[pokemon].js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function Pokemon({ pokemon, fallbackData }) {
<br />
<br />
<Link href="/">
<a>Back</a>
Back
</Link>
</div>
)
Expand Down
2 changes: 1 addition & 1 deletion examples/server-render/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function Home({ fallbackData }) {
? data.results.map(pokemon => (
<p key={pokemon.name}>
<Link href="/[pokemon]" as={`/${pokemon.name}`}>
<a>{pokemon.name}</a>
{pokemon.name}
</Link>
</p>
))
Expand Down
2 changes: 1 addition & 1 deletion examples/suspense/pages/[user]/[repo].js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function Repo() {
<br />
<br />
<Link href="/">
<a>Back</a>
Back
</Link>
</div>
)
Expand Down
2 changes: 1 addition & 1 deletion examples/suspense/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const Repos = () => {
{data.map(project => (
<p key={project}>
<Link href="/[user]/[repo]" as={`/${project}`}>
<a>{project}</a>
{project}
</Link>
</p>
))}
Expand Down

0 comments on commit 9371f1d

Please sign in to comment.