-
Notifications
You must be signed in to change notification settings - Fork 13
/
index.js
89 lines (83 loc) · 2.63 KB
/
index.js
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import React, { Component } from 'react';
import Card from 'react-bootstrap/Card';
import Row from 'react-bootstrap/Row';
import Col from 'react-bootstrap/Col';
import Button from 'react-bootstrap/Button';
import { LinkContainer } from 'react-router-bootstrap';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import {
faTrash,
faPen
} from '@fortawesome/free-solid-svg-icons';
class SimpleCard extends Component {
handleDelete = () => {
//eslint-disable-next-line
const confirmationPrompt = confirm(
"Click OK if you wish to delete, cancel if you don't"
);
if (confirmationPrompt === true) {
if (this.props.handleDelete) {
this.props.handleDelete(this.props.id);
}
} else {
alert('All is good, it was not deleted');
}
};
handleEdit = () => {
this.props.handleEdit(this.props.id);
}
showLinkPath = () => {
return this.props.showLinkPath(this.props.id);
}
render() {
return (
<Card style={ { width: '100%', marginBottom: '1em' } }>
<Card.Body>
<Row>
<LinkContainer to={ this.showLinkPath() } style={ { cursor: 'pointer' } } >
<Col xs={ 8 } sm={ 10 } md={ 10 } ld={ 10 } xl={ 10 }>
<Card.Title>
<a href={ `#${ this.showLinkPath() }` } >
{this.props.title}
</a>
</Card.Title>
</Col>
</LinkContainer>
<Col xs={ 2 } sm={ 1 } md={ 1 } ld={ 1 } xl={ 1 }>
<Card.Link>
<Button
onClick={ this.handleEdit }
variant="outline-secondary"
size="sm"
>
<FontAwesomeIcon icon={ faPen } />
</Button>
</Card.Link>
</Col>
<Col xs={ 2 } sm={ 1 } md={ 1 } ld={ 1 } xl={ 1 }>
<Card.Link>
<Button
onClick={ this.handleDelete }
variant="outline-secondary"
size="sm"
>
<FontAwesomeIcon icon={ faTrash } />
</Button>
</Card.Link>
</Col>
</Row>
<LinkContainer to={ this.showLinkPath() } style={ { cursor: 'pointer' } } >
<Row>
<Col xs={ 10 } sm={ 11 } md={ 11 } ld={ 11 } xl={ 11 }>
<Card.Subtitle className="mb-2 text-muted">
{ this.props.description }
</Card.Subtitle>
</Col>
</Row>
</LinkContainer>
</Card.Body>
</Card>
);
}
}
export default SimpleCard;