-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
zoujia
committed
May 30, 2024
1 parent
330b48a
commit e94edba
Showing
4 changed files
with
92 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { useRouteError } from "react-router-dom"; | ||
|
||
export default function ErrorPage() { | ||
const error = useRouteError(); | ||
console.log('>> ErrorPage error: ', error); | ||
|
||
return ( | ||
<div id="error-page"> | ||
<h1>Oops!</h1> | ||
<p>Sorry, an unexpected error has occurred.</p> | ||
<p> | ||
<i>{error.statusText || error.message}</i> | ||
</p> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
export default function Contact() { | ||
const contact = { | ||
first: "Your", | ||
last: "Name", | ||
avatar: "https://placekitten.com/g/200/200", | ||
twitter: "your_handle", | ||
notes: "Some notes", | ||
favorite: true, | ||
}; | ||
|
||
return ( | ||
<div id="contact"> | ||
<div> | ||
<img | ||
key={contact.avatar} | ||
src={contact.avatar || null} | ||
/> | ||
</div> | ||
<div> | ||
{/* TODO: */} | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
export default function Root() { | ||
return ( | ||
<> | ||
<div id="sidebar"> | ||
<h1>React Rooter Contacts</h1> | ||
<div> | ||
<form id="search-form" role="search"> | ||
<input | ||
id="q" | ||
aria-label="Search contacts" | ||
placeholder="Search" | ||
type="search" | ||
name="q" | ||
/> | ||
<div | ||
id="search-spinner" | ||
aria-hidden | ||
hidden={true} | ||
/> | ||
<div | ||
className="sr-only" | ||
aria-live="polite" | ||
></div> | ||
</form> | ||
<form method="post"> | ||
<button type="submit">New</button> | ||
</form> | ||
</div> | ||
<nav> | ||
<ul> | ||
<li> | ||
<a href={`/contacts/1`}>Your Name</a> | ||
</li> | ||
<li> | ||
<a href={`/contacts/2`}>Your Friend</a> | ||
</li> | ||
</ul> | ||
</nav> | ||
</div> | ||
<div id="detail"></div> | ||
</> | ||
); | ||
} |