Skip to content

Commit ba81d67

Browse files
committed
Add footer, style card hover
1 parent 2cc904b commit ba81d67

File tree

8 files changed

+75
-13
lines changed

8 files changed

+75
-13
lines changed

client/App.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ import {Container} from '/client/components/layout';
55
import {BrowserRouter, Route} from 'react-router-dom';
66
import {about} from '/imports/paths';
77
import Menu from '/client/components/Menu';
8+
import Footer from '/client/components/Footer';
89
import {createStore} from 'redux';
910
import reducer from './state';
1011
import {Provider} from 'react-redux';
1112
import 'semantic-ui-css/semantic.min.css';
13+
import './app.styl';
1214

1315
const links = [
1416
{href: '/', label: 'Home'},
@@ -26,6 +28,7 @@ const App = () => (
2628
<Route exact path="/" component={VinNumbers} />
2729
<Route exact path={about} component={About} />
2830
</div>
31+
<Footer />
2932
</Container>
3033
</BrowserRouter>
3134
</Provider>

client/app.styl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#app-container
2+
min-height: 750px
3+
display: flex
4+
flex-direction: column
5+
6+
#main-screen
7+
flex: 1
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#footer
2+
margin-top 2rem

client/components/Footer/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from 'react';
2+
import {Menu} from 'semantic-ui-react';
3+
4+
export default class Footer extends React.Component {
5+
render() {
6+
return (
7+
<Menu id="footer" attached="bottom">
8+
Footer
9+
</Menu>
10+
);
11+
}
12+
}

client/components/Hover.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
4+
export default class Hover extends React.Component {
5+
state = {
6+
hovered: false
7+
};
8+
9+
render() {
10+
const {hovered} = this.state;
11+
const {children} = this.props;
12+
return (
13+
<span
14+
onMouseOver={() => this.setState({hovered: true})}
15+
onFocus={() => this.setState({hovered: true})}
16+
onMouseOut={() => this.setState({hovered: false})}
17+
onBlur={() => this.setState({hovered: false})}
18+
>
19+
{children(hovered)}
20+
</span>
21+
);
22+
}
23+
}
24+
25+
Hover.propTypes = {
26+
children: PropTypes.func.isRequired,
27+
};

client/main.styl

Whitespace-only changes.

client/pages/VinNumbers/VinNumberCard.js

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import PropTypes from 'prop-types';
33
import {Button, Card} from 'semantic-ui-react';
44
import {removeVin} from '/imports/api/vinNumbers/methods';
5+
import Hover from '/client/components/Hover';
56

67
export default class VinNumberCard extends React.Component {
78
onRemove() {
@@ -17,18 +18,22 @@ export default class VinNumberCard extends React.Component {
1718
render() {
1819
const {vin} = this.props;
1920
return (
20-
<Card>
21-
<Card.Content>
22-
<Card.Header>VIN {vin.value}</Card.Header>
23-
<Card.Meta>{vin.friendlyCreationDate()}</Card.Meta>
24-
</Card.Content>
25-
<Card.Content extra>
26-
<Button.Group fluid>
27-
<Button basic positive>Approve</Button>
28-
<Button basic negative onClick={() => this.onRemove()}>Remove</Button>
29-
</Button.Group>
30-
</Card.Content>
31-
</Card>
21+
<Hover>
22+
{hovered => (
23+
<Card raised={hovered}>
24+
<Card.Content>
25+
<Card.Header>VIN # {vin.value}</Card.Header>
26+
<Card.Meta>{vin.friendlyCreationDate()}</Card.Meta>
27+
</Card.Content>
28+
<Card.Content extra>
29+
<Button.Group fluid>
30+
<Button basic positive>Approve</Button>
31+
<Button basic negative onClick={() => this.onRemove()}>Remove</Button>
32+
</Button.Group>
33+
</Card.Content>
34+
</Card>
35+
)}
36+
</Hover>
3237
);
3338
}
3439
}

imports/startup/server/seedVinNumbers.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ import {addVin} from '/imports/api/vinNumbers/methods';
33

44
const isSeededAlready = () => VinNumbers.find().count() > 1;
55

6+
const dummyVins = [
7+
{value: 'Vin1', notes: 'Note1'},
8+
{value: 'Vin2', notes: 'Note2'},
9+
{value: 'Vin3', notes: 'Note3'},
10+
];
11+
612
const seedVinNumbers = () => {
713
if (isSeededAlready()) {
814
console.log('Server is seeded');
@@ -11,7 +17,7 @@ const seedVinNumbers = () => {
1117

1218
console.log('Running seed function');
1319

14-
const vinInserts = ['Vin1', 'Vin2', 'Vin3'].map(value => addVin.callPromise({value}));
20+
const vinInserts = dummyVins.map(vin => addVin.callPromise(vin));
1521
Promise.all(vinInserts)
1622
.catch(err => console.error('Seeding the server failed', err))
1723
.then(() => console.log(`Successfully seeded the server with ${vinInserts.length} vin numbers`));

0 commit comments

Comments
 (0)