File tree Expand file tree Collapse file tree 8 files changed +75
-13
lines changed
Expand file tree Collapse file tree 8 files changed +75
-13
lines changed Original file line number Diff line number Diff line change @@ -5,10 +5,12 @@ import {Container} from '/client/components/layout';
55import { BrowserRouter , Route } from 'react-router-dom' ;
66import { about } from '/imports/paths' ;
77import Menu from '/client/components/Menu' ;
8+ import Footer from '/client/components/Footer' ;
89import { createStore } from 'redux' ;
910import reducer from './state' ;
1011import { Provider } from 'react-redux' ;
1112import 'semantic-ui-css/semantic.min.css' ;
13+ import './app.styl' ;
1214
1315const 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 >
Original file line number Diff line number Diff line change 1+ #app-container
2+ min-height : 750px
3+ display : flex
4+ flex-direction : column
5+
6+ #main-screen
7+ flex : 1
Original file line number Diff line number Diff line change 1+ #footer
2+ margin-top 2rem
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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+ } ;
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import React from 'react';
22import PropTypes from 'prop-types' ;
33import { Button , Card } from 'semantic-ui-react' ;
44import { removeVin } from '/imports/api/vinNumbers/methods' ;
5+ import Hover from '/client/components/Hover' ;
56
67export 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}
Original file line number Diff line number Diff line change @@ -3,6 +3,12 @@ import {addVin} from '/imports/api/vinNumbers/methods';
33
44const 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+
612const 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` ) ) ;
You can’t perform that action at this time.
0 commit comments