This repository has been archived by the owner on Jan 3, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More Frontend: React Router and WCA-Component Library (#54)
- Loading branch information
1 parent
fb08425
commit 973d72e
Showing
16 changed files
with
166 additions
and
73 deletions.
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
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 |
---|---|---|
@@ -1,9 +1,42 @@ | ||
// External Styles (this is probably not the best way to load this?) | ||
import '@thewca/wca-components/dist/index.esm.css' | ||
import React from 'react' | ||
import { createRoot } from 'react-dom/client' | ||
import App from './register/pages' | ||
import { createBrowserRouter, Link, RouterProvider } from 'react-router-dom' | ||
import Registrations from './pages/registrations' | ||
import Register from './pages/register' | ||
|
||
const router = createBrowserRouter([ | ||
{ | ||
path: '/', | ||
element: ( | ||
<div> | ||
<Link to="/register"> Register </Link> | ||
<Link to="/registrations"> Registrations</Link> | ||
</div> | ||
), | ||
}, | ||
{ | ||
path: '/register', | ||
element: ( | ||
<div> | ||
<Register /> | ||
</div> | ||
), | ||
}, | ||
{ | ||
path: '/registrations', | ||
element: ( | ||
<div> | ||
<Registrations /> | ||
</div> | ||
), | ||
}, | ||
]) | ||
|
||
// Clear the existing HTML content | ||
document.body.innerHTML = '<div id="app"></div>' | ||
|
||
// Render your React component instead | ||
const root = createRoot(document.querySelector('#app')) | ||
root.render(App()) | ||
root.render(<RouterProvider router={router} />) |
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
File renamed without changes.
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 |
---|---|---|
|
@@ -4,8 +4,4 @@ | |
align-items: center; | ||
margin-top: 24%; | ||
width: 50vw; | ||
} | ||
|
||
.events{ | ||
display: flex; | ||
} |
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,15 @@ | ||
import React from 'react' | ||
import { Link } from 'react-router-dom' | ||
import RegistrationPanel from './components/RegistrationPanel' | ||
import styles from './index.module.scss' | ||
|
||
export default function Register() { | ||
return ( | ||
<div className={styles.container}> | ||
<RegistrationPanel /> | ||
<div className={styles.link}> | ||
<Link to="/registrations"> Registration List </Link> | ||
</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,11 @@ | ||
.container { | ||
display: flex; | ||
height: 100vh; | ||
flex-direction: row; | ||
} | ||
|
||
.link{ | ||
position: absolute; | ||
left: 5vw; | ||
top: 5vh; | ||
} |
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
File renamed without changes.
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,15 @@ | ||
import React from 'react' | ||
import { Link } from 'react-router-dom' | ||
import RegistrationList from './components/RegistrationList' | ||
import styles from './index.module.scss' | ||
|
||
export default function Registrations() { | ||
return ( | ||
<div className={styles.container}> | ||
<RegistrationList /> | ||
<div className={styles.link}> | ||
<Link to="/register"> Register </Link> | ||
</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 |
---|---|---|
|
@@ -2,4 +2,9 @@ | |
display: flex; | ||
height: 100vh; | ||
flex-direction: row; | ||
} | ||
.link{ | ||
position: absolute; | ||
left: 5vw; | ||
top: 5vh; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const path = require('path') | ||
|
||
const statsPlugin = () => ({ | ||
name: 'stats', | ||
setup(build) { | ||
build.onStart(() => { | ||
// eslint-disable-next-line no-console | ||
console.time('build time') | ||
}) | ||
build.onEnd((result) => { | ||
if (result.metafile) { | ||
Object.entries(result.metafile.outputs).forEach(([file, { bytes }]) => { | ||
const relPath = path.relative( | ||
process.cwd(), | ||
path.resolve(__dirname, file) | ||
) | ||
|
||
const i = Math.floor(Math.log(bytes) / Math.log(1024)) | ||
const humanBytes = | ||
Number((bytes / 1024 ** i).toFixed(2)) + | ||
['B', 'kB', 'MB', 'GB', 'TB'][i] | ||
console.info(relPath, humanBytes) | ||
}) | ||
} else if ('errors' in result) { | ||
console.info( | ||
`build failed with ${result.errors.length} errors, ${result.warnings.length} warnings` | ||
) | ||
console.info(result) | ||
} else { | ||
console.error(result) | ||
} | ||
// eslint-disable-next-line no-console | ||
console.timeEnd('build time') | ||
}) | ||
}, | ||
}) | ||
|
||
module.exports = statsPlugin |
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