Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ampers: Alex; #32

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
card text displays per card in browser
  • Loading branch information
brownav committed Jun 11, 2018
commit 1a91d18267f9307444a26d5e3d4feb544a70a0a5
4 changes: 2 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class App extends Component {
<h1 className="header__h1"><span className="header__text">Inspiration Board</span></h1>
</header>
<Board
url="https://inspiration-board.herokuapp.com/boards/"
boardName={`Ada-Lovelace`}
// url="https://inspiration-board.herokuapp.com/boards/"
// boardName={`Ada-Lovelace`}
/>
</section>
);
Expand Down
32 changes: 23 additions & 9 deletions src/components/Board.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,49 @@ import PropTypes from 'prop-types';
import axios from 'axios';
import './Board.css';
import Card from './Card';
import NewCardForm from './NewCardForm';
import CARD_DATA from '../data/card-data.json';
// import NewCardForm from './NewCardForm';
// import CARD_DATA from '../data/card-data.json';

class Board extends Component {
constructor() {
super();
constructor(props) {
super(props);

this.state = {
cards: [],
};
}

componentDidMount = () => {
axios.get('https://inspiration-board.herokuapp.com/boards/alexandria/cards')
.then((response) => {
this.setState({
cards: response.data
})
})
.catch((error) => {
this.setState({
error: error.message
})
});
}

renderCardList = () => {
const cardList = this.state.cards.map((card, index) => {
return (
<Card
key={index}
text={card.text}
emoji={card.emoji}
text={card.card.text}
emoji={card.card.emoji}
/>
);
});

return cardList;
}

render() {
return (
<div>
<Card/>
<div className="board">
{this.renderCardList()}
</div>
)
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Card.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import './Card.css';
class Card extends Component {
render() {
return (
<div className="card">
<article className="card">
<p>{this.props.text}</p>
<p>{this.props.emoji}</p>
</div>
</article>
)
}
}
Expand Down