Initial commit
This commit is contained in:
commit
15d4e2f126
37 changed files with 12580 additions and 0 deletions
25
crabfit-frontend/src/App.js
Normal file
25
crabfit-frontend/src/App.js
Normal 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;
|
||||
8
crabfit-frontend/src/App.test.js
Normal file
8
crabfit-frontend/src/App.test.js
Normal 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();
|
||||
});
|
||||
13
crabfit-frontend/src/index.css
Normal file
13
crabfit-frontend/src/index.css
Normal 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;
|
||||
}
|
||||
17
crabfit-frontend/src/index.js
Normal file
17
crabfit-frontend/src/index.js
Normal 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();
|
||||
14
crabfit-frontend/src/pages/Event/Event.js
Normal file
14
crabfit-frontend/src/pages/Event/Event.js
Normal 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;
|
||||
12
crabfit-frontend/src/pages/Home/Home.js
Normal file
12
crabfit-frontend/src/pages/Home/Home.js
Normal 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;
|
||||
2
crabfit-frontend/src/pages/index.js
Normal file
2
crabfit-frontend/src/pages/index.js
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export { default as Home } from './Home/Home';
|
||||
export { default as Event } from './Event/Event';
|
||||
13
crabfit-frontend/src/reportWebVitals.js
Normal file
13
crabfit-frontend/src/reportWebVitals.js
Normal 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;
|
||||
5
crabfit-frontend/src/setupTests.js
Normal file
5
crabfit-frontend/src/setupTests.js
Normal 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';
|
||||
Loading…
Add table
Add a link
Reference in a new issue