Skip to content

Commit

Permalink
Merge pull request #4 from malkrc/gophers-frontend
Browse files Browse the repository at this point in the history
added routing
  • Loading branch information
TheGorlox authored Dec 6, 2020
2 parents e324497 + edc1838 commit 7b34b36
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 2 deletions.
96 changes: 96 additions & 0 deletions react/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"react": "^17.0.1",
"react-bootstrap": "^1.4.0",
"react-dom": "^17.0.1",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.0",
"web-vitals": "^0.2.4"
},
Expand Down
31 changes: 29 additions & 2 deletions react/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,29 @@ import GopherRepoGroup from './GopherRepoGroup'
import './App.css';
import 'bootstrap/dist/css/bootstrap.min.css';
import { Row } from 'react-bootstrap';
import {
BrowserRouter as Router,
Switch,
Route,
Link
} from "react-router-dom";
function App() {
return (
<div className="App">
{/* <Container> */}
<Row>
<Router>
<Col xs={3}>

<Nav defaultActiveKey="/home" className="flex-column">
<Nav.Link href="/home">Active</Nav.Link>
<Nav.Link eventKey="link-1">Link</Nav.Link>
<Link to='/groups'>Groups</Link>
<Nav.Link eventKey="link-2">Link</Nav.Link>
<Nav.Link eventKey="disabled" disabled>
Disabled
</Nav.Link>
</Nav>

</Col>
<Col>
<InputGroup size="lg">
Expand All @@ -33,7 +41,20 @@ function App() {
</InputGroup.Prepend>
<FormControl aria-label="Large" aria-describedby="inputGroup-sizing-sm" />
</InputGroup>
<GopherRepoGroup></GopherRepoGroup>

{/* A <Switch> looks through its children <Route>s and
renders the first one that matches the current URL. */}
<Switch>
<Route path="/groups">
<GopherRepoGroup />
</Route>

<Route path="/">
<Home />
</Route>
</Switch>

{/* <GopherRepoGroup></GopherRepoGroup> */}
{/* <CardDeck>
<Card style={{ width: '18rem' }}>
<Card.Body>
Expand All @@ -47,10 +68,16 @@ function App() {
</Card>
</CardDeck> */}
</Col>
</Router>
</Row>
{/* </Container> */}
</div>
);
}

export default App;


function Home() {
return <h2>Home</h2>;
}

0 comments on commit 7b34b36

Please sign in to comment.