forked from Techtonica/curriculum
-
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
1 parent
75624fb
commit 359b33d
Showing
8 changed files
with
128 additions
and
22 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -71,3 +71,7 @@ button.btn.btn-primary { | |
margin-left: 2em; | ||
margin-right: 2em; | ||
} | ||
|
||
#contact{ | ||
padding: 5em; | ||
} |
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
49 changes: 49 additions & 0 deletions
49
projects/2023TemplateWithVite/client/src/components/contact.jsx
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,49 @@ | ||
|
||
|
||
export default function Contact() { | ||
const contact = { | ||
first: "Cristina", | ||
last: "Rodriguez", | ||
avatar: "https://placekitten.com/g/200/200", | ||
twitter: "yosola", | ||
notes: "Some notes", | ||
favorite: true, | ||
}; | ||
|
||
return ( | ||
<div id="contact"> | ||
<div> | ||
<img | ||
key={contact.avatar} | ||
src={contact.avatar || null} | ||
/> | ||
</div> | ||
|
||
<div> | ||
<h1> | ||
{contact.first || contact.last ? ( | ||
<> | ||
{contact.first} {contact.last} | ||
</> | ||
) : ( | ||
<i>No Name</i> | ||
)}{" "} | ||
</h1> | ||
|
||
{contact.twitter && ( | ||
<p> | ||
<a | ||
target="_blank" | ||
href={`https://twitter.com/${contact.twitter}`} | ||
> | ||
{contact.twitter} | ||
</a> | ||
</p> | ||
)} | ||
|
||
{contact.notes && <p>{contact.notes}</p>} | ||
|
||
</div> | ||
</div> | ||
) | ||
} |
16 changes: 16 additions & 0 deletions
16
projects/2023TemplateWithVite/client/src/components/error-page.jsx
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.error(error); | ||
|
||
return ( | ||
<div id="error-page"> | ||
<h1>Oops Techtonica template apologizes!!</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,33 @@ | ||
import React from 'react' | ||
import ReactDOM from 'react-dom/client' | ||
import App from './App' | ||
import { createBrowserRouter, createRoutesFromElements, Route, RouterProvider,} from "react-router-dom"; | ||
import './index.css' | ||
import ErrorPage from "./components/error-page"; | ||
import Contact from "./components/contact"; | ||
|
||
|
||
// /* | ||
// const router = createBrowserRouter( | ||
// createRoutesFromElements( | ||
// <Route path="/" element={<App />}> | ||
// <Route path="login" element={<Contact />} /> | ||
// </Route> | ||
// ) | ||
// ); | ||
|
||
// */ | ||
|
||
const router = createBrowserRouter( | ||
createRoutesFromElements( | ||
<Route path="/" element={<App />}> | ||
<Route path="login" element={<Contact />} /> | ||
</Route> | ||
) | ||
); | ||
|
||
ReactDOM.createRoot(document.getElementById('root')).render( | ||
<React.StrictMode> | ||
<App /> | ||
<RouterProvider router={router} /> | ||
</React.StrictMode>, | ||
) |
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