Skip to content

Commit adde1c2

Browse files
author
Samuel Weke
committed
updated note
1 parent 8776ee6 commit adde1c2

File tree

6 files changed

+58
-14
lines changed

6 files changed

+58
-14
lines changed

package-lock.json

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6+
"@fortawesome/fontawesome-svg-core": "^1.2.25",
7+
"@fortawesome/free-solid-svg-icons": "^5.11.2",
68
"@fortawesome/react-fontawesome": "^0.1.7",
79
"bootstrap": "^4.3.1",
810
"react": "^16.10.2",

src/App.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,8 @@ body {
1212
a {
1313
color: #333;
1414
text-decoration: none;
15+
}
16+
17+
.single-note{
18+
width: '900px',
1519
}

src/App.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { Component } from 'react';
22
import Navbar from './components/Navbar';
33
import Notes from './components/Notes';
4+
import { Container, Row } from 'react-bootstrap'
45
import uuid from 'uuid';
56
import './App.css';
67

@@ -31,6 +32,10 @@ class App extends Component {
3132
});
3233
};
3334

35+
// editBtn = (id) => {
36+
// console.log(id)
37+
// };
38+
3439
deleteBtn = (id) => {
3540
const notes = this.state.notes.filter((note) =>
3641
note.id !== id
@@ -45,15 +50,16 @@ class App extends Component {
4550
return (
4651
<div className="App">
4752
<Navbar addNote={this.addNote}/>
48-
<div className="container">
49-
<div className="row">
53+
<Container>
54+
<Row>
5055
<Notes
5156
notes={this.state.notes}
5257
handleDelete={this.deleteBtn}
58+
handleEdit={this.editBtn}
5359
addNote={this.addNote}
5460
/>
55-
</div>
56-
</div>
61+
</Row>
62+
</Container>
5763
</div>
5864
)
5965
}

src/components/Note.js

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,46 @@
11
import React, { Component } from 'react';
2-
2+
import { Col } from 'react-bootstrap'
3+
import { faTrash, faWindowClose } from "@fortawesome/free-solid-svg-icons";
4+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
35

46
class Note extends Component {
57
render() {
68
return (
7-
<div className="col-4 mb-3">
8-
<div style={noteStyle} className="card">
9+
<Col>
10+
<div style={noteStyle} className="card mb-3">
911
<div style={cardHeader} className="card-header bg-dark">{this.props.note.title}</div>
1012
<div style={cardBody} className="card-body">{this.props.note.body}</div>
11-
<div className="d-flex justify-content-between">
12-
<button className="btn btn-danger btn-sm" onClick={() => this.props.handleDelete(this.props.note.id)}>Del</button>
13-
<button className="btn btn-primary btn-sm">Edit</button>
13+
<div className="d-flex justify-content-flex-end ml-2 mb-2">
14+
<FontAwesomeIcon
15+
icon={faWindowClose}
16+
style= {{fontSize: '20px'}}
17+
className="text-danger mr-3"
18+
onClick={() => this.props.handleDelete(this.props.note.id)}
19+
/>
20+
{/* <FontAwesomeIcon
21+
icon={faEdit}
22+
onClick={() => this.props.handleEdit(this.props.note.id)} /> */}
1423
</div>
1524
</div>
16-
</div>
25+
</Col>
1726
)
1827
}
1928
}
2029

2130
const noteStyle = {
22-
width: '320px',
31+
width: '330px',
2332
height: '250px',
33+
backgroundColor: '#FCFCFA',
2434
};
2535

2636
const cardHeader = {
2737
color: '#fff'
2838
};
2939

3040
const cardBody = {
31-
overflow: 'visible',
41+
overflowY: 'auto',
3242
}
3343

3444

45+
3546
export default Note;

src/components/Notes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class Notes extends Component {
55
render() {
66
return (
77
this.props.notes.map(note =>
8-
<Note key={note.id} note={note} handleDelete={this.props.handleDelete} />
8+
<Note key={note.id} note={note} handleEdit={this.props.handleEdit} handleDelete={this.props.handleDelete} />
99
)
1010
)
1111
}

0 commit comments

Comments
 (0)