Skip to content
This repository was archived by the owner on Jan 7, 2020. It is now read-only.

Commit fa23259

Browse files
committed
image card
1 parent 28f5eb6 commit fa23259

9 files changed

+120
-29
lines changed

src/App.jsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Header from './Header'
55
import Home from './Home'
66
import NotFound from './common/NotFound'
77
import Footer from './Footer'
8-
//import Subsets from './Subsets'
8+
import Subsets from './Subsets'
99

1010
import './app.css'
1111

@@ -17,10 +17,12 @@ const App = () => {
1717
<Route exact path="/" component={Home} />
1818
{/*
1919
<Route path="/all-data/:year?" component={Subsets} />
20+
*/}
2021
<Route
2122
path="/subsets/:year?"
2223
component={Subsets}
2324
/>
25+
{/*
2426
<Route
2527
path="/maps-graphs/:year?"
2628
component={MapsGraphs}

src/Card.jsx

-15
This file was deleted.

src/Home.css

-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@
2525
margin: 0 auto 3rem;
2626
max-width: 1040px;
2727
}
28-
.home .header {
29-
border-bottom: none;
30-
}
3128
.home .card-container {
3229
align-items: stretch;
3330
display: flex;

src/Home.jsx

+28-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { Component } from 'react'
2-
import ImageCard from './Card.jsx'
2+
import ImageCard from './ImageCard.jsx'
33
import Header from './common/Header.jsx'
44
import spreadsheet from './images/spreadsheet.png'
55
import selector from './images/selector.png'
@@ -24,16 +24,38 @@ class Home extends Component {
2424
<div className="card-container">
2525
<ImageCard
2626
image={spreadsheet}
27-
caption="Entire datasets"
28-
/>
27+
caption="Entire datasets (coming soon)"
28+
path="/all-data"
29+
>
30+
<ul>
31+
<li>Lorem ipsum dolor sit amet</li>
32+
<li>Mauris nec dolor id elit</li>
33+
<li>Aliquam facilisis lorem eget</li>
34+
</ul>
35+
</ImageCard>
2936
<ImageCard
3037
image={selector}
3138
caption="Subsets of data"
32-
/>
39+
path="subsets"
40+
enabled
41+
>
42+
<ul>
43+
<li>Lorem ipsum dolor sit amet</li>
44+
<li>Mauris nec dolor id elit</li>
45+
<li>Aliquam facilisis lorem eget</li>
46+
</ul>
47+
</ImageCard>
3348
<ImageCard
3449
image={map}
35-
caption="Maps & Graphs"
36-
/>
50+
caption="Maps & Graphs (coming soon)"
51+
path="maps-graphs"
52+
>
53+
<ul>
54+
<li>Lorem ipsum dolor sit amet</li>
55+
<li>Mauris nec dolor id elit</li>
56+
<li>Aliquam facilisis lorem eget</li>
57+
</ul>
58+
</ImageCard>
3759
</div>
3860
</div>
3961
)

src/Card.css src/ImageCard.css

+14-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
11
.ImageCard {
2-
border: 2px solid white;
32
overflow: hidden;
3+
opacity: 0.5;
4+
pointer-events: none;
5+
}
6+
7+
.ImageCard.enabled {
8+
opacity: 1;
9+
pointer-events: auto;
10+
}
11+
12+
.ImageWrapper {
13+
border: 2px solid white;
414
}
515

6-
.ImageCard:hover {
16+
.ImageCard.enabled .ImageWrapper:hover {
717
border-color: #0071bc;
818
cursor: pointer;
919
}
1020

11-
.ImageCard:hover .imagechild {
21+
.ImageWrapper:hover .imagechild {
1222
transform: scale(1.1);
1323
}
1424

15-
.ImageCard:hover > h4 {
25+
.ImageCard.enabled:hover h4 {
1626
color: #0071bc;
1727
}
1828

src/ImageCard.jsx

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import React, { Component } from 'react'
2+
import { Link } from 'react-router-dom'
3+
import './ImageCard.css'
4+
5+
const ImageCard = props => {
6+
let cardClass='ImageCard card'
7+
if(props.enabled) cardClass += ' enabled'
8+
9+
return (
10+
<div className={cardClass}>
11+
<Link
12+
disabled={!props.enabled}
13+
to={props.path}>
14+
<div className="ImageWrapper">
15+
<img src={props.image} alt={props.caption} className="imagechild"/>
16+
</div>
17+
<h4>{props.caption}</h4>
18+
</Link>
19+
{props.children}
20+
</div>
21+
)
22+
}
23+
24+
export default ImageCard

src/Subsets.css

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.Subsets {
2+
max-width: 1040px;
3+
margin: 0 auto;
4+
padding: 0 3rem;
5+
}

src/Subsets.jsx

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import React, { Component } from 'react'
2+
import Select from 'react-select'
3+
import Header from './common/Header.jsx'
4+
import STATES from './constants/states.js'
5+
6+
import './Subsets.css'
7+
8+
const options = STATES.map(state => {
9+
return { value: state.id, label: state.name }
10+
})
11+
12+
class Subsets extends Component {
13+
render() {
14+
return (
15+
<div className="Subsets">
16+
<div className="intro">
17+
<Header type={1} headingText="Subsets of HMDA data">
18+
<p className="lead">
19+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris eu varius orci. Nunc id augue justo. Fusce aliquam imperdiet lacus eu condimentum. Praesent et maximus ipsum. Fusce quis orci et lorem maximus maximus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
20+
</p>
21+
</Header>
22+
</div>
23+
<>
24+
<Header type={4} headingText="Select a state" />
25+
<Select
26+
onChange={this.handleChange}
27+
placeholder="Select a state..."
28+
searchable={true}
29+
autoFocus
30+
openOnFocus
31+
simpleValue
32+
options={options}
33+
/>
34+
</>
35+
<div>
36+
</div>
37+
</div>
38+
)
39+
}
40+
}
41+
42+
export default Subsets

src/app.css

+4
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,7 @@ hr {
9696
.button-link:hover {
9797
color: #4c2c92;
9898
}
99+
100+
.header {
101+
border-bottom: none;
102+
}

0 commit comments

Comments
 (0)