Skip to content

Commit 90baa61

Browse files
committed
Feat: Tooltips
1 parent f3d6cef commit 90baa61

File tree

6 files changed

+352
-197
lines changed

6 files changed

+352
-197
lines changed

src/App.js

+18-4
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,16 @@ class App extends Component {
369369
}
370370

371371
handleCopyEvent(e, copiedContent = "") {
372+
if (copiedContent) {
373+
return navigator.clipboard
374+
.writeText(copiedContent)
375+
.then(() => {
376+
// Success!
377+
})
378+
.catch((err) => {
379+
console.log("Something went wrong", err);
380+
});
381+
}
372382
if (typeof window.getSelection != "undefined") {
373383
var sel = window.getSelection();
374384
if (sel.rangeCount) {
@@ -383,10 +393,14 @@ class App extends Component {
383393
copiedContent = document.selection.createRange().htmlText;
384394
}
385395
}
386-
387-
e.clipboardData.setData("text/html", copied);
388-
e.clipboardData.setData("text/plain", html2md.turndown(copied));
389-
e.preventDefault();
396+
navigator.clipboard
397+
.writeText(html2md.turndown(copiedContent))
398+
.then(() => {
399+
// Success!
400+
})
401+
.catch((err) => {
402+
console.log("Something went wrong", err);
403+
});
390404
}
391405

392406
handleSearchNotes(e) {

src/NavbarMain.js

+35-25
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,41 @@ function NavbarMain(props) {
66
return (
77
<div className={isActive === true ? "nav-bar" : "hidden"}>
88
<div>
9-
<i
10-
className="far fa-copy btn"
11-
id="copyBtn"
12-
onClick={(e) => props.handleCopyNote(e, note)}
13-
></i>
14-
<i
15-
className="far fa-edit btn"
16-
id="editbtn"
17-
data-action="updatenote"
18-
onClick={(e) => props.handleEditNoteBtn(e, note)}
19-
>
20-
{" "}
21-
</i>
22-
<i
23-
className="far fa-trash-alt btn"
24-
aria-hidden="true"
25-
style={{ float: "right" }}
26-
onClick={(e) => props.handleDeleteNote(e, note)}
27-
></i>
28-
<i
29-
className="far fa-arrow-alt-circle-down btn"
30-
aria-hidden="true"
31-
style={{ float: "right" }}
32-
onClick={(e) => props.handleDownloadNote(note)}
33-
></i>
9+
<span tooltip="Copy" flow="down">
10+
<i
11+
className="far fa-copy btn"
12+
id="copyBtn"
13+
onClick={(e) => props.handleCopyEvent(e, note.notebody)}
14+
></i>
15+
</span>
16+
<span tooltip="Edit" flow="down">
17+
<i
18+
className="far fa-edit btn"
19+
id="editbtn"
20+
data-action="updatenote"
21+
onClick={(e) => props.handleEditNoteBtn(e, note)}
22+
>
23+
{" "}
24+
</i>
25+
</span>
26+
27+
<div style={{ float: "right" }}>
28+
<span tooltip="Download" flow="down">
29+
<i
30+
className="far fa-arrow-alt-circle-down btn"
31+
aria-hidden="true"
32+
// style={{ float: "right" }}
33+
onClick={(e) => props.handleDownloadNote(note)}
34+
></i>
35+
</span>
36+
<span tooltip="Delete" flow="down">
37+
<i
38+
className="far fa-trash-alt btn"
39+
aria-hidden="true"
40+
onClick={(e) => props.handleDeleteNote(e, note)}
41+
></i>
42+
</span>
43+
</div>
3444
</div>
3545
</div>
3646
);

src/NavbarSidebar.js

+17-13
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,24 @@ function NavbarSidebar(props) {
1515
<div>
1616
<div className="nav-bar-left">
1717
<div className="nav-left-icon">
18-
<i
19-
id="homeBtn"
20-
onClick={(e) => props.handleClickHomeBtn(e)}
21-
className="fa fa-home btn"
22-
aria-hidden="true"
23-
></i>
18+
<span tooltip="Home" flow="right">
19+
<i
20+
id="homeBtn"
21+
onClick={(e) => props.handleClickHomeBtn(e)}
22+
className="fa fa-home btn"
23+
aria-hidden="true"
24+
></i>
25+
</span>
2426
<h4>Notes</h4>
25-
<i
26-
id="addNoteBtn"
27-
data-action="addnote"
28-
onClick={(e) => props.handleEditNoteBtn(e, note)}
29-
className="fa fa-plus btn"
30-
aria-hidden="true"
31-
></i>
27+
<span tooltip="Add Note" flow="left">
28+
<i
29+
id="addNoteBtn"
30+
data-action="addnote"
31+
onClick={(e) => props.handleEditNoteBtn(e, note)}
32+
className="fa fa-plus btn"
33+
aria-hidden="true"
34+
></i>
35+
</span>
3236
</div>
3337
</div>
3438
<div className="search-bar">

0 commit comments

Comments
 (0)