Skip to content

Commit 81e0a58

Browse files
timdavishbbmoz
authored andcommitted
Feature/#154826346 - User sees the causes for each project (#168)
* chore(data): update project seed data * feature(client): add causes as Chips to projects
1 parent 9242d98 commit 81e0a58

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

.setup/db/seedData/projects.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"name": "Example Project #2",
1818
"role": "Mary Org Role 2",
1919
"email": "[email protected]",
20-
"causes": ["Environment"],
20+
"causes": ["Environment", "Animal", "International NGO", "Health"],
2121
"applications": [
2222
{ "$oid": "5a1658a0327c0286c39a1aaa" }
2323
],

client/components/ListOfProjects/ListOfProjects.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { Component } from 'react'
22
import { connect } from 'react-redux'
33
import PropTypes from 'prop-types'
44
import GridList, { GridListTile } from 'material-ui/GridList'
5+
import Chip from 'material-ui/Chip'
56

67
import UserActionCreator from '../../actions/user'
78
import Project from '../Project/Project'
@@ -15,13 +16,23 @@ class ListOfProjects extends Component {
1516
}
1617

1718
renderListOfProjects () {
18-
return this.props.projects.map((project, index) => {
19+
return this.props.projects.map((project, projectIndex) => {
1920
return (
20-
<GridListTile key={index}>
21+
<GridListTile key={projectIndex}>
2122
<Project
2223
project={project}
2324
authenticated={this.props.authenticated}
2425
applyForProject={this.props.applyForProject} />
26+
27+
<div className={styles.causesContainer}>
28+
{ project.causes.map((cause, chipIndex) => {
29+
return (
30+
<Chip key={`${projectIndex}${chipIndex}`}
31+
className={styles.cause}
32+
label={cause} />
33+
)
34+
})}
35+
</div>
2536
</GridListTile>
2637
)
2738
})

client/components/ListOfProjects/ListOfProjects.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,15 @@
2020
.list {
2121
width: 100% !important;
2222
}
23+
24+
.causesContainer {
25+
display: inline-flex;
26+
width: 100%;
27+
overflow-x: scroll;
28+
margin-bottom: -17px;
29+
}
30+
31+
.cause {
32+
margin-bottom: 70px;
33+
margin-right: 5px;
34+
}

0 commit comments

Comments
 (0)