Skip to content

Commit cb79d62

Browse files
committed
💾 Replaced Button Text with Icons
1 parent a8e5d88 commit cb79d62

File tree

5 files changed

+44
-21
lines changed

5 files changed

+44
-21
lines changed

package-lock.json

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "markdown-editor",
3-
"version": "1.9.0",
3+
"version": "1.9.1",
44
"description": "A react app to preview and edit Markdown",
55
"private": true,
66
"author": {
@@ -21,6 +21,7 @@
2121
"react": "^16.13.1",
2222
"react-dom": "^16.13.1",
2323
"react-full-screen": "^0.3.1",
24+
"react-icons": "^3.11.0",
2425
"react-scripts": "3.4.1",
2526
"react-split": "^2.0.7"
2627
},

src/App.scss

+7-6
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,21 @@ body {
4040
width: 0%;
4141
}
4242

43-
.btn {
43+
.btn{
44+
display:flex;
45+
align-items: center;
46+
justify-content: center;
4447
cursor: pointer;
45-
font-size: 0.9rem;
46-
padding: 0.4rem 1rem;
47-
font-weight: 600;
48-
border-radius: 0.2rem;
48+
font-size: 1.1rem;
49+
border-radius: 0.3rem;
4950
display: inline-block;
50-
line-height: 1.2rem;
5151
color: var(--nav-item-color);
5252
background-color: var(--primary-color);
5353
transition: color, background-color var(--color-transition);
5454
border: none;
5555
transition: filter 200ms ease;
5656
margin: 0 0.5rem;
57+
padding:0.4rem .4rem .15rem;
5758
&:hover {
5859
filter: brightness(1.1);
5960
}

src/components/MarkdownEdit.jsx

+13-6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import React, { useEffect, useState, useRef } from "react";
22
import Snackbar from "@material-ui/core/Snackbar";
33
import { Alert, AlertTitle } from "@material-ui/lab";
44
import placeholder from "../data/placeholder";
5+
import { MdContentCopy as CopyIcon } from "react-icons/md";
6+
import { MdDelete as CleanIcon } from "react-icons/md";
7+
import { Tooltip } from "@material-ui/core";
58

69
function MarkdownEdit({ content, changeContent }) {
710
const [open, setOpen] = useState(false);
@@ -39,12 +42,16 @@ function MarkdownEdit({ content, changeContent }) {
3942
<div className="section-title">
4043
<h3>Markdown</h3>
4144
<div className="right-section">
42-
<button onClick={handleCopyButton} className="btn">
43-
Copy
44-
</button>
45-
<button onClick={handleClearButton} className="btn">
46-
Clear
47-
</button>
45+
<Tooltip title="Copy to Clipboard">
46+
<button onClick={handleCopyButton} className="btn">
47+
<CopyIcon />
48+
</button>
49+
</Tooltip>
50+
<Tooltip title="Clean">
51+
<button onClick={handleClearButton} className="btn">
52+
<CleanIcon />
53+
</button>
54+
</Tooltip>
4855
</div>
4956
</div>
5057
<textarea

src/components/MarkdownPreview.jsx

+14-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import React, { useState, useEffect } from "react";
22
import * as marked from "marked";
3-
import Prism from "prismjs";
3+
import Prism from "prismjs"; //css for Prism is imported in ThemeSelector
44
import "../utils/prism-imports";
55
import { FullScreen, useFullScreenHandle } from "react-full-screen";
6-
//css for Prism is imported in ThemeSelector
6+
import { CgSoftwareDownload as SaveIcon } from "react-icons/cg";
7+
import { RiFullscreenFill as FullScreenIcon } from "react-icons/ri";
8+
import { Tooltip } from "@material-ui/core";
79

810
function MarkdownPreview({ content }) {
911
const [html, setHtml] = useState(getHtml(content));
@@ -22,8 +24,8 @@ function MarkdownPreview({ content }) {
2224

2325
const handleSaveClick = () => {
2426
let link = document.createElement("a");
25-
link.href=`data:text/html,${html}`;
26-
link.download="export.html";
27+
link.href = `data:text/html,${html}`;
28+
link.download = "export.html";
2729
link.click();
2830
};
2931

@@ -32,12 +34,16 @@ function MarkdownPreview({ content }) {
3234
<div className="section-title">
3335
<h3>Preview</h3>
3436
<div className="right-section">
37+
<Tooltip title="FullScreen" title="Download HTML">
3538
<button className="btn" onClick={handleSaveClick}>
36-
Save
37-
</button>
38-
<button className="btn" onClick={handleFullScreen}>
39-
Fullscreen
39+
<SaveIcon />
4040
</button>
41+
</Tooltip>
42+
<Tooltip title="FullScreen">
43+
<button className="btn" onClick={handleFullScreen}>
44+
<FullScreenIcon />
45+
</button>
46+
</Tooltip>
4147
</div>
4248
</div>
4349
<FullScreen handle={handle}>

0 commit comments

Comments
 (0)