Initial commit

This commit is contained in:
Ben Grant 2021-02-26 13:19:13 +11:00
commit 15d4e2f126
37 changed files with 12580 additions and 0 deletions

View file

@ -0,0 +1,25 @@
import {
BrowserRouter,
Switch,
Route,
Redirect,
useLocation,
} from 'react-router-dom';
import {
Home,
Event,
} from 'pages';
const App = () => {
return (
<BrowserRouter>
<Switch>
<Route path="/" component={Home} exact />
<Route path="/:id" component={Event} exact />
</Switch>
</BrowserRouter>
);
}
export default App;

View file

@ -0,0 +1,8 @@
import { render, screen } from '@testing-library/react';
import App from './App';
test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});

View file

@ -0,0 +1,13 @@
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}

View file

@ -0,0 +1,17 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();

View file

@ -0,0 +1,14 @@
import { Link } from 'react-router-dom';
const Event = (props) => {
const id = props.match.params.id;
return (
<div>
<div>Event {id}</div>
<Link to="/">Back home</Link>
</div>
);
};
export default Event;

View file

@ -0,0 +1,12 @@
import { Link } from 'react-router-dom';
const Home = () => {
return (
<div>
<div>Home</div>
<Link to="/test">Test</Link>
</div>
);
};
export default Home;

View file

@ -0,0 +1,2 @@
export { default as Home } from './Home/Home';
export { default as Event } from './Event/Event';

View file

@ -0,0 +1,13 @@
const reportWebVitals = onPerfEntry => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};
export default reportWebVitals;

View file

@ -0,0 +1,5 @@
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';