Skip to content
This repository was archived by the owner on Sep 8, 2018. It is now read-only.

Commit 404c1b3

Browse files
committed
Add 404 and make scaling better
1 parent 35d5bc4 commit 404c1b3

File tree

10 files changed

+43
-34
lines changed

10 files changed

+43
-34
lines changed

src/Routes.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import Home from './routers/Home'
77
import Test from './routers/Test'
88
import AllBots from './routers/AllBots'
99
import EditBot from './routers/EditBot'
10+
import NotFound from './routers/NotFound'
1011

1112
class Routes extends Component {
1213
render () {
@@ -18,6 +19,7 @@ class Routes extends Component {
1819
<Route path="/test" component={Test} />
1920
<Route path="/bots" component={AllBots} />
2021
<Route path="/edit/:id" component={EditBot} />
22+
<Route component={NotFound} />
2123
</Switch>
2224
</App>
2325
</Router>

src/components/BotCard.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
import React, { Component } from 'react'
22
import PropTypes from 'prop-types'
3+
import { Link } from 'react-router-dom'
34

45
export default class BotCard extends Component {
56
render () {
67
return (
7-
<article className="bot-cards-card">
8-
<img className="bot-card-avatar" src={this.props.bot.avatar} alt={this.props.bot.name + "'s avatar"}/>
9-
<h1>{this.props.bot.name}</h1>
10-
<p>{this.props.bot.description}</p>
11-
</article>
8+
<Link to={'/bot/' + this.props.bot.id}>
9+
<article className="bot-cards-card">
10+
<img className="bot-card-avatar" src={this.props.bot.avatar} alt={this.props.bot.name + "'s avatar"}/>
11+
<h1>{this.props.bot.name}</h1>
12+
<p>{this.props.bot.description}</p>
13+
</article>
14+
</Link>
1215
)
1316
}
1417
}

src/components/ErrorBox.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ export default class ErrorBox extends Component {
1919

2020
ErrorBox.propTypes = {
2121
colour: PropTypes.string,
22-
children: PropTypes.oneOf(PropTypes.string, PropTypes.React)
22+
children: PropTypes.oneOf([PropTypes.string, PropTypes.React])
2323
}

src/routers/NotFound.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React, { Component } from 'react'
2+
import ErrorBox from './../components/ErrorBox'
3+
4+
export default class Test extends Component {
5+
render () {
6+
return (
7+
<main>
8+
<ErrorBox colour="red">Not Found</ErrorBox>
9+
</main>
10+
)
11+
}
12+
}

src/sass/components/_botcard.sass

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
width: 120px
1313
background-color: #555
1414
margin-right: 20px
15-
margin-top: 10px
16-
margin-bottom: 10px
15+
margin-top: 20px
16+
margin-bottom: 20px
1717
padding: 5px
1818
display: flex
1919
flex-direction: column

src/sass/components/_botstrip.sass

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
flex-wrap: nowrap
99
overflow-x: auto
1010
overflow-y: hidden
11-
.bot-cards-card:last-of-type
12-
margin-right: 100px
1311

1412
.bot-strip-tab
1513
padding-top: 15px

src/sass/components/_main.sass

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@ main
22
text-align: center
33
code
44
text-align: left
5-
background-color: #333333
65
background-size: cover
6+
margin-left: auto
7+
margin-right: auto
78
padding: 2em
9+
box-sizing: border-box
810
flex-grow: 1
911
@media screen and (min-width: 600px)
10-
padding: 1em 5em 1em 5em
12+
width: 100%
1113
@media screen and (min-width: 800px)
12-
padding: 1em 10em 1em 10em
14+
width: 70%
1315
@media screen and (min-width: 1200px)
14-
padding: 1em 15em 1em 15em
15-
@media screen and (min-width: 1600px)
16-
padding: 1em 25em 1em 25em
17-
@media screen and (min-width: 2000px)
18-
padding: 1em 35em 1em 35em
16+
width: 50%

src/sass/index.css

Lines changed: 10 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/sass/index.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/sass/index.sass

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
body
1616
padding: 0
1717
margin: 0
18+
background-color: #333333
1819

1920
.App
2021
display: flex

0 commit comments

Comments
 (0)