From bdcc2edb38fb0e57604fa12d25b2a4b478261e18 Mon Sep 17 00:00:00 2001 From: Eug-VS Date: Sat, 4 Apr 2020 22:05:40 +0300 Subject: refactor: structurize Markdown component :recycle: --- src/lib/Markdown/CodeBlock.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/lib/Markdown/CodeBlock.tsx (limited to 'src/lib/Markdown/CodeBlock.tsx') diff --git a/src/lib/Markdown/CodeBlock.tsx b/src/lib/Markdown/CodeBlock.tsx new file mode 100644 index 0000000..e449f92 --- /dev/null +++ b/src/lib/Markdown/CodeBlock.tsx @@ -0,0 +1,13 @@ +import React from 'react'; +import { ParserPropTypes } from './types'; + +const CodeBlock: React.FC = ({ rawLines }) => { + return ( +

+ {rawLines.map(line => <> {line}
)} +

+ ); +} + +export default CodeBlock; + -- cgit v1.2.3 From 6087d49a95b6c4164068c219847efc1e70399cb5 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sun, 5 Apr 2020 02:38:47 +0300 Subject: feat: add some paddings --- src/lib/Markdown/CodeBlock.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib/Markdown/CodeBlock.tsx') diff --git a/src/lib/Markdown/CodeBlock.tsx b/src/lib/Markdown/CodeBlock.tsx index e449f92..ee2114e 100644 --- a/src/lib/Markdown/CodeBlock.tsx +++ b/src/lib/Markdown/CodeBlock.tsx @@ -3,7 +3,7 @@ import { ParserPropTypes } from './types'; const CodeBlock: React.FC = ({ rawLines }) => { return ( -

+

{rawLines.map(line => <> {line}
)}

); -- cgit v1.2.3 From 39e1d32c669545ccc30e0d424323c6a01317c4be Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sun, 5 Apr 2020 12:56:41 +0300 Subject: refactor: move some logic to InlineSyntax.tsx --- src/lib/Markdown/CodeBlock.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib/Markdown/CodeBlock.tsx') diff --git a/src/lib/Markdown/CodeBlock.tsx b/src/lib/Markdown/CodeBlock.tsx index ee2114e..2718647 100644 --- a/src/lib/Markdown/CodeBlock.tsx +++ b/src/lib/Markdown/CodeBlock.tsx @@ -3,7 +3,7 @@ import { ParserPropTypes } from './types'; const CodeBlock: React.FC = ({ rawLines }) => { return ( -

+

{rawLines.map(line => <> {line}
)}

); -- cgit v1.2.3 From 62a543258a111f0f45be74b6ec3d887e15f67376 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sun, 5 Apr 2020 14:18:45 +0300 Subject: feat: beautify CodeBlock --- src/lib/Markdown/CodeBlock.tsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/lib/Markdown/CodeBlock.tsx') diff --git a/src/lib/Markdown/CodeBlock.tsx b/src/lib/Markdown/CodeBlock.tsx index 2718647..cbb3078 100644 --- a/src/lib/Markdown/CodeBlock.tsx +++ b/src/lib/Markdown/CodeBlock.tsx @@ -1,11 +1,23 @@ import React from 'react'; import { ParserPropTypes } from './types'; +import { Paper } from '@material-ui/core'; + +import { makeStyles } from '@material-ui/core/styles'; + +const useStyles = makeStyles(theme => ({ + root: { + background: theme.palette.background.default, + padding: theme.spacing(2), + overflowX: 'auto', + }, +})); const CodeBlock: React.FC = ({ rawLines }) => { + const classes = useStyles(); return ( -

+ {rawLines.map(line => <> {line}
)} -

+ ); } -- cgit v1.2.3 From 1a00cd504ff60f1749327ebc3896a4641d28670e Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sun, 5 Apr 2020 16:31:28 +0300 Subject: feat: install emojilib, beautify inline code --- src/lib/Markdown/CodeBlock.tsx | 1 + 1 file changed, 1 insertion(+) (limited to 'src/lib/Markdown/CodeBlock.tsx') diff --git a/src/lib/Markdown/CodeBlock.tsx b/src/lib/Markdown/CodeBlock.tsx index cbb3078..c4478eb 100644 --- a/src/lib/Markdown/CodeBlock.tsx +++ b/src/lib/Markdown/CodeBlock.tsx @@ -9,6 +9,7 @@ const useStyles = makeStyles(theme => ({ background: theme.palette.background.default, padding: theme.spacing(2), overflowX: 'auto', + fontFamily: 'Monospace', }, })); -- cgit v1.2.3 From 1f67a4e15b9ab10f8ecba2ee93e6a4c44e3c71ec Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sun, 5 Apr 2020 21:10:50 +0300 Subject: fix: use
 in CodeBlock

---
 src/lib/Markdown/CodeBlock.tsx | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'src/lib/Markdown/CodeBlock.tsx')

diff --git a/src/lib/Markdown/CodeBlock.tsx b/src/lib/Markdown/CodeBlock.tsx
index c4478eb..5b8edec 100644
--- a/src/lib/Markdown/CodeBlock.tsx
+++ b/src/lib/Markdown/CodeBlock.tsx
@@ -7,9 +7,10 @@ import { makeStyles } from '@material-ui/core/styles';
 const useStyles = makeStyles(theme => ({
   root: {
     background: theme.palette.background.default,
-    padding: theme.spacing(2),
+    padding: theme.spacing(1),
     overflowX: 'auto',
     fontFamily: 'Monospace',
+    scrollbarColor: 'auto'
   },
 }));
 
@@ -17,7 +18,7 @@ const CodeBlock: React.FC = ({ rawLines }) => {
   const classes = useStyles();
   return (
     
-      {rawLines.map(line => <> {line} 
)} + {rawLines.map(line =>
{line}
)}
); } -- cgit v1.2.3