forked from AdaGold/inspiration-board
-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathCard.js
More file actions
38 lines (31 loc) · 887 Bytes
/
Card.js
File metadata and controls
38 lines (31 loc) · 887 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import emoji from 'emoji-dictionary';
import './Card.css';
class Card extends Component {
render() {
const emojiName = this.props.emoji ? this.props.emoji : '';
return (
<div className="card">
<div className="card__content">
<p className="card__content-text">{this.props.text}</p>
<span className="card__content-emoji">{emoji.getUnicode(emojiName)}</span>
<button
type="button"
aria-label="Delete"
className="card__delete"
onClick={() => this.props.onDeleteClickCallback(this.props.id)}
>
Delete
</button>
</div>
</div>
)
}
}
Card.propTypes = {
id: PropTypes.number,
text: PropTypes.string,
emoji: PropTypes.string,
};
export default Card;