opsnippets 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +47 -49
- package/assets.d.ts +5 -5
- package/dist/components/Button.d.ts +0 -0
- package/dist/components/CodeBlock.d.ts +0 -0
- package/dist/components/OneLineComand.d.ts +0 -0
- package/dist/components/OneLineCommand.d.ts +11 -0
- package/dist/hooks/counter.d.ts +0 -0
- package/dist/index.d.ts +1 -3
- package/dist/index.js +87 -44
- package/package.json +29 -29
- package/rollup.config.js +22 -22
- package/src/assets/copy.png +0 -0
- package/src/assets/tick.png +0 -0
- package/src/components/CodeBlock.tsx +41 -41
- package/src/components/OneLineCommand.tsx +201 -0
- package/src/index.ts +2 -4
- package/tsconfig.json +10 -10
- package/src/components/Button.tsx +0 -19
- package/src/components/OneLineComand.tsx +0 -88
- package/src/hooks/counter.tsx +0 -18
package/README.md
CHANGED
@@ -1,49 +1,47 @@
|
|
1
|
-
# Installation
|
2
|
-
|
3
|
-
```bash
|
4
|
-
npm i opsnippets
|
5
|
-
```
|
6
|
-
|
7
|
-
# Usage
|
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
|
-
<a href="https://imgbb.com/"><img src="https://i.ibb.co/vYJqrrc/Screenshot-from-2024-08-10-18-13-23.png" alt="Screenshot-from-2024-08-10-18-13-23" border="0"></a>
|
1
|
+
# Installation
|
2
|
+
|
3
|
+
```bash
|
4
|
+
npm i opsnippets
|
5
|
+
```
|
6
|
+
|
7
|
+
# Usage
|
8
|
+
```javascript
|
9
|
+
import { CodeBlock} from "demo"
|
10
|
+
function App() {
|
11
|
+
const code = `
|
12
|
+
import React from 'react';
|
13
|
+
import CodeSnippet from './CodeSnippet';
|
14
|
+
const App = () => {
|
15
|
+
return (
|
16
|
+
<div>
|
17
|
+
<h1>My Code Snippet Example</h1>
|
18
|
+
<CodeSnippet />
|
19
|
+
</div>
|
20
|
+
);
|
21
|
+
};
|
22
|
+
export default App;`
|
23
|
+
return (
|
24
|
+
<>
|
25
|
+
<CodeBlock code={code} />
|
26
|
+
</>
|
27
|
+
)
|
28
|
+
}
|
29
|
+
export default App;
|
30
|
+
```
|
31
|
+
<a href="https://imgbb.com/"><img src="https://i.ibb.co/gVrTCJN/Screenshot-from-2024-08-10-18-12-35.png" border="0"></a>
|
32
|
+
|
33
|
+
|
34
|
+
```javascript
|
35
|
+
import { OneLineBlock} from "demo"
|
36
|
+
function App() {
|
37
|
+
return (
|
38
|
+
<>
|
39
|
+
<OneLineBlock command="npm i mongoose" />
|
40
|
+
</>
|
41
|
+
)
|
42
|
+
}
|
43
|
+
export default App;
|
44
|
+
```
|
45
|
+
|
46
|
+
|
47
|
+
<a href="https://imgbb.com/"><img src="https://i.ibb.co/vYJqrrc/Screenshot-from-2024-08-10-18-13-23.png" alt="Screenshot-from-2024-08-10-18-13-23" border="0"></a>
|
package/assets.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
// src/assets.d.ts
|
2
|
-
declare module '*.png' {
|
3
|
-
const src: string;
|
4
|
-
export default src;
|
5
|
-
}
|
1
|
+
// src/assets.d.ts
|
2
|
+
declare module '*.png' {
|
3
|
+
const src: string;
|
4
|
+
export default src;
|
5
|
+
}
|
6
6
|
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
type TypeProp = "dark" | "light" | "basic" | "blue" | "green" | "purple" | "orange" | "red" | "yellow" | "teal";
|
3
|
+
interface props {
|
4
|
+
command: string;
|
5
|
+
type: TypeProp;
|
6
|
+
width?: string;
|
7
|
+
height?: string;
|
8
|
+
title?: string;
|
9
|
+
}
|
10
|
+
declare const OneLineBlock: ({ command, type, width, height, title, }: props) => React.JSX.Element;
|
11
|
+
export { OneLineBlock };
|
package/dist/hooks/counter.d.ts
CHANGED
File without changes
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
@@ -3,31 +3,11 @@ import { useState } from 'react';
|
|
3
3
|
import { Prism } from 'react-syntax-highlighter';
|
4
4
|
import { atomDark } from 'react-syntax-highlighter/dist/esm/styles/prism';
|
5
5
|
|
6
|
-
const UseCounter = () => {
|
7
|
-
const [count, setCount] = useState(0);
|
8
|
-
const increment = () => {
|
9
|
-
setCount(count + 1);
|
10
|
-
};
|
11
|
-
const decrement = () => {
|
12
|
-
setCount(count - 1);
|
13
|
-
};
|
14
|
-
return { increment, decrement, count };
|
15
|
-
};
|
16
|
-
|
17
|
-
const Increment = () => {
|
18
|
-
const { increment } = UseCounter();
|
19
|
-
return (React.createElement("button", { onClick: increment }, "Increment"));
|
20
|
-
};
|
21
|
-
const Decrement = () => {
|
22
|
-
const { decrement } = UseCounter();
|
23
|
-
return (React.createElement("button", { onClick: decrement }, "Decrement"));
|
24
|
-
};
|
25
|
-
|
26
6
|
var copyIcon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAB8xSURBVHic7d150GdVfefxd3dDN0Ir0A3DZifd7EpYFMagIqaB0TipGElYjCbMpIpJJVFHTDCk4mhZkxlj4rgVOG6URFBRiWYYdSTDolKiU4ZFQI2ACLIvjWwNvdDL/HEeEFn693ue372/7zn3+35VnepUxdJPn6fvuZ/nLufOQ6rDAuAlwErgUGB/YDdgMb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wB/C+BvAfwtgL8F8LcA/hbA3wL4WwB/C2ia5gn+bVzA4ln+FsDfAvhbAH8L4G8B/C2AvwXwtwD+FsA/fgH8sxfAP3sB/LMXwD97AfyzF8A/cwF9/C2Af/wC+GcvgH/2Ap7hn72Au/zDF8DfAvhbAH8L4G8B/C2AvwXwtwD+FsDfAvhbAH8L4G8B/C2AvwXwtwD+FsDfAvinL4B/9gL4Zy+Af/YC+GcvgH/2AvhnL4B/9gL4Zy+Af/YC+GcvgH/2AvhnL4B/9gL4Zy+Af/YC+GcvgH/2AvhnL4B/9gL4Zy+Af/YC+GcvgH/2AvhnL4B/9gL4Zy+Af/YC+GcvgH/2AvhnL4B/9gL4Zy+Af/YC+GcvgH97u7x7uP81/i1uaOsQ/p0JR2p1F1YO9N8cdKKW1zd3gP9SvwO1v0uLD+FfHfXpP6KOkeV9+DfGup0mpa6ByTt79WeGe5wlq/PjUzfn17bXF2anr17sdA9JkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkiRJkvQY9TtWXIJiBquu+QAAAABJRU5ErkJggg==";
|
29
9
|
|
30
|
-
const OneLineBlock = ({ command }) => {
|
10
|
+
const OneLineBlock = ({ command, type, width = "400", height = "0", title = "Terminal", }) => {
|
31
11
|
const [isCopied, setIsCopied] = useState(false);
|
32
12
|
const copyToClipboard = () => {
|
33
13
|
navigator.clipboard.writeText(command);
|
@@ -36,52 +16,115 @@ const OneLineBlock = ({ command }) => {
|
|
36
16
|
setIsCopied(false);
|
37
17
|
}, 1000);
|
38
18
|
};
|
19
|
+
const colorScheme = {
|
20
|
+
dark: {
|
21
|
+
background: "#1A1B26",
|
22
|
+
text: "#A3E635",
|
23
|
+
highlight: "#7dd3fc",
|
24
|
+
border: "1px solid #2D3748",
|
25
|
+
},
|
26
|
+
light: {
|
27
|
+
background: "#f8fafc",
|
28
|
+
text: "#334155",
|
29
|
+
highlight: "#2563eb",
|
30
|
+
border: "1px solid #94a3b8",
|
31
|
+
},
|
32
|
+
basic: {
|
33
|
+
background: "#272822",
|
34
|
+
text: "#F8F8F2",
|
35
|
+
highlight: "#66D9EF",
|
36
|
+
border: "1px solid #A6E22E",
|
37
|
+
},
|
38
|
+
blue: {
|
39
|
+
background: "#1E3A8A",
|
40
|
+
text: "#BFDBFE",
|
41
|
+
highlight: "#3B82F6",
|
42
|
+
border: "1px solid #60A5FA",
|
43
|
+
},
|
44
|
+
green: {
|
45
|
+
background: "#064E3B",
|
46
|
+
text: "#D1FAE5",
|
47
|
+
highlight: "#10B981",
|
48
|
+
border: "1px solid #22D3EE",
|
49
|
+
},
|
50
|
+
purple: {
|
51
|
+
background: "#4C1D95",
|
52
|
+
text: "#E9D5FF",
|
53
|
+
highlight: "#A78BFA",
|
54
|
+
border: "1px solid #C084FC",
|
55
|
+
},
|
56
|
+
orange: {
|
57
|
+
background: "#7C2D12",
|
58
|
+
text: "#FFEDD5",
|
59
|
+
highlight: "#FB923C",
|
60
|
+
border: "1px solid #F97316",
|
61
|
+
},
|
62
|
+
red: {
|
63
|
+
background: "#7F1D1D",
|
64
|
+
text: "#FFE4E6",
|
65
|
+
highlight: "#EF4444",
|
66
|
+
border: "1px solid #F87171",
|
67
|
+
},
|
68
|
+
yellow: {
|
69
|
+
background: "#78350F",
|
70
|
+
text: "#FEF9C3",
|
71
|
+
highlight: "#FACC15",
|
72
|
+
border: "1px solid #FBBF24",
|
73
|
+
},
|
74
|
+
teal: {
|
75
|
+
background: "#134E4A",
|
76
|
+
text: "#CCFBF1",
|
77
|
+
highlight: "#14B8A6",
|
78
|
+
border: "1px solid #2DD4BF",
|
79
|
+
},
|
80
|
+
};
|
81
|
+
const colors = colorScheme[type];
|
39
82
|
return (React.createElement("div", { style: {
|
40
|
-
width: "
|
41
|
-
background:
|
42
|
-
display:
|
83
|
+
width: width + "px",
|
84
|
+
background: colors.background,
|
85
|
+
display: "flex",
|
43
86
|
flexDirection: "column",
|
44
|
-
// justifyItems: "center",
|
45
87
|
padding: "2px",
|
46
88
|
borderRadius: "5px",
|
47
|
-
color:
|
89
|
+
color: colors.text,
|
48
90
|
fontFamily: "Arial, sans-serif",
|
49
91
|
fontSize: "18px",
|
50
92
|
fontWeight: "bold",
|
51
93
|
} },
|
52
94
|
React.createElement("div", { style: {
|
53
|
-
height:
|
54
|
-
display:
|
95
|
+
height: "50px",
|
96
|
+
display: "flex",
|
55
97
|
justifyContent: "space-between",
|
56
|
-
border: "1px ",
|
57
98
|
alignItems: "center",
|
58
|
-
borderBottom:
|
59
|
-
padding:
|
99
|
+
borderBottom: colors.border,
|
100
|
+
padding: "5px",
|
60
101
|
} },
|
61
102
|
React.createElement("p", { style: {
|
62
|
-
color:
|
63
|
-
fontSize:
|
103
|
+
color: colors.highlight,
|
104
|
+
fontSize: "20px",
|
64
105
|
padding: "5px",
|
65
|
-
fontWeight:
|
66
|
-
} },
|
106
|
+
fontWeight: "lighter",
|
107
|
+
} }, title),
|
67
108
|
React.createElement("button", { onClick: () => copyToClipboard(), style: {
|
68
109
|
width: "30px",
|
69
|
-
height:
|
70
|
-
cursor: "pointer"
|
110
|
+
height: "30px",
|
111
|
+
cursor: "pointer",
|
112
|
+
background: "none",
|
113
|
+
border: "none",
|
71
114
|
} },
|
72
115
|
React.createElement("img", { width: "100%", height: "100%", style: {
|
73
|
-
objectFit: "contain"
|
74
|
-
}, src: !isCopied ? copyIcon : tickIcon }))),
|
116
|
+
objectFit: "contain",
|
117
|
+
}, src: !isCopied ? copyIcon : tickIcon, alt: isCopied ? "Copied" : "Copy" }))),
|
75
118
|
React.createElement("div", { style: {
|
76
119
|
display: "flex",
|
77
120
|
alignItems: "center",
|
78
|
-
gap: "10px"
|
121
|
+
gap: "10px",
|
79
122
|
} },
|
80
123
|
React.createElement("span", { className: "icon" },
|
81
|
-
React.createElement("svg", { viewBox: "0 0 24 24", fill:
|
82
|
-
React.createElement("path", { d: "m9 5 7 7-7 7",
|
124
|
+
React.createElement("svg", { viewBox: "0 0 24 24", fill: colors.highlight, height: "13", width: "13", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true" },
|
125
|
+
React.createElement("path", { d: "m9 5 7 7-7 7", strokeWidth: "3", strokeLinejoin: "round", strokeLinecap: "round", stroke: "currentColor" }))),
|
83
126
|
React.createElement("p", { style: {
|
84
|
-
fontFamily: "monospace"
|
127
|
+
fontFamily: "monospace",
|
85
128
|
} }, command))));
|
86
129
|
};
|
87
130
|
|
@@ -117,4 +160,4 @@ const CodeBlock = ({ code }) => {
|
|
117
160
|
}, src: !isCopied ? copyIcon : tickIcon }))));
|
118
161
|
};
|
119
162
|
|
120
|
-
export { CodeBlock,
|
163
|
+
export { CodeBlock, OneLineBlock };
|
package/package.json
CHANGED
@@ -1,29 +1,29 @@
|
|
1
|
-
{
|
2
|
-
"name": "opsnippets",
|
3
|
-
"version": "1.0.
|
4
|
-
"description": "",
|
5
|
-
"main": "dist/index.js",
|
6
|
-
"type": "module",
|
7
|
-
"types": "dist/index.d.ts",
|
8
|
-
|
9
|
-
"scripts": {
|
10
|
-
"build": "npx rollup -c"
|
11
|
-
},
|
12
|
-
"keywords": ["code","snippets","block","code block","snippets generator"],
|
13
|
-
"author": "om pharate",
|
14
|
-
"license": "ISC",
|
15
|
-
"devDependencies": {
|
16
|
-
"@rollup/plugin-babel": "^6.0.4",
|
17
|
-
"@rollup/plugin-typescript": "^11.1.6",
|
18
|
-
"@types/react": "^18.3.3",
|
19
|
-
"react": "^18.3.1",
|
20
|
-
"react-dom": "^18.3.1",
|
21
|
-
"rollup": "^4.20.0",
|
22
|
-
"rollup-plugin-url": "^3.0.1",
|
23
|
-
"tslib": "^2.6.3"
|
24
|
-
},
|
25
|
-
"dependencies": {
|
26
|
-
"@types/react-syntax-highlighter": "^15.5.13",
|
27
|
-
"react-syntax-highlighter": "^15.5.0"
|
28
|
-
}
|
29
|
-
}
|
1
|
+
{
|
2
|
+
"name": "opsnippets",
|
3
|
+
"version": "1.0.3",
|
4
|
+
"description": "",
|
5
|
+
"main": "dist/index.js",
|
6
|
+
"type": "module",
|
7
|
+
"types": "dist/index.d.ts",
|
8
|
+
|
9
|
+
"scripts": {
|
10
|
+
"build": "npx rollup -c"
|
11
|
+
},
|
12
|
+
"keywords": ["code","snippets","block","code block","snippets generator"],
|
13
|
+
"author": "om pharate",
|
14
|
+
"license": "ISC",
|
15
|
+
"devDependencies": {
|
16
|
+
"@rollup/plugin-babel": "^6.0.4",
|
17
|
+
"@rollup/plugin-typescript": "^11.1.6",
|
18
|
+
"@types/react": "^18.3.3",
|
19
|
+
"react": "^18.3.1",
|
20
|
+
"react-dom": "^18.3.1",
|
21
|
+
"rollup": "^4.20.0",
|
22
|
+
"rollup-plugin-url": "^3.0.1",
|
23
|
+
"tslib": "^2.6.3"
|
24
|
+
},
|
25
|
+
"dependencies": {
|
26
|
+
"@types/react-syntax-highlighter": "^15.5.13",
|
27
|
+
"react-syntax-highlighter": "^15.5.0"
|
28
|
+
}
|
29
|
+
}
|
package/rollup.config.js
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
import { defineConfig } from "rollup";
|
2
|
-
import typescript from "@rollup/plugin-typescript";
|
3
|
-
import url from "rollup-plugin-url"; // Import the URL plugin
|
4
|
-
|
5
|
-
export default defineConfig({
|
6
|
-
input: "src/index.ts",
|
7
|
-
output: {
|
8
|
-
dir: "dist",
|
9
|
-
format: "es",
|
10
|
-
name: "demo",
|
11
|
-
},
|
12
|
-
external: ["react", "react-dom"],
|
13
|
-
plugins: [
|
14
|
-
typescript({ tsconfig: "tsconfig.json" }),
|
15
|
-
url({
|
16
|
-
// Inline files smaller than 10 kbytes
|
17
|
-
limit: 10 * 1024,
|
18
|
-
// Output the files in a specific directory if the limit is exceeded
|
19
|
-
fileName: '[name].[hash][extname]',
|
20
|
-
}),
|
21
|
-
],
|
22
|
-
});
|
1
|
+
import { defineConfig } from "rollup";
|
2
|
+
import typescript from "@rollup/plugin-typescript";
|
3
|
+
import url from "rollup-plugin-url"; // Import the URL plugin
|
4
|
+
|
5
|
+
export default defineConfig({
|
6
|
+
input: "src/index.ts",
|
7
|
+
output: {
|
8
|
+
dir: "dist",
|
9
|
+
format: "es",
|
10
|
+
name: "demo",
|
11
|
+
},
|
12
|
+
external: ["react", "react-dom"],
|
13
|
+
plugins: [
|
14
|
+
typescript({ tsconfig: "tsconfig.json" }),
|
15
|
+
url({
|
16
|
+
// Inline files smaller than 10 kbytes
|
17
|
+
limit: 10 * 1024,
|
18
|
+
// Output the files in a specific directory if the limit is exceeded
|
19
|
+
fileName: '[name].[hash][extname]',
|
20
|
+
}),
|
21
|
+
],
|
22
|
+
});
|
package/src/assets/copy.png
CHANGED
File without changes
|
package/src/assets/tick.png
CHANGED
File without changes
|
@@ -1,42 +1,42 @@
|
|
1
|
-
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
|
2
|
-
import { atomDark } from 'react-syntax-highlighter/dist/esm/styles/prism';
|
3
|
-
import copyIcon from '../assets/copy.png'
|
4
|
-
import tickIcon from '../assets/tick.png'
|
5
|
-
import { useState } from 'react';
|
6
|
-
import * as React from 'react';
|
7
|
-
const CodeBlock = ({ code }: { code: string }) => {
|
8
|
-
const [isCopied, setIsCopied] = useState(false);
|
9
|
-
const copyToClipboard = () => {
|
10
|
-
navigator.clipboard.writeText(code);
|
11
|
-
setIsCopied(true);
|
12
|
-
setTimeout(() => {
|
13
|
-
setIsCopied(false);
|
14
|
-
}, 1000);
|
15
|
-
}
|
16
|
-
return (
|
17
|
-
<div style={{
|
18
|
-
display:"flex",
|
19
|
-
alignItems:'start',
|
20
|
-
justifyContent:"space-between",
|
21
|
-
padding:"5px",
|
22
|
-
borderRadius:"5px",
|
23
|
-
color:"white",
|
24
|
-
fontFamily:"Arial, sans-serif",
|
25
|
-
fontSize:"18px",
|
26
|
-
backgroundColor:'rgb(29, 31, 33)',
|
27
|
-
width:"40%",
|
28
|
-
}}>
|
29
|
-
<SyntaxHighlighter language="javascript" style={atomDark}>
|
30
|
-
{code}
|
31
|
-
</SyntaxHighlighter>
|
32
|
-
<button onClick={() => copyToClipboard()} style={{
|
33
|
-
width: "30px",
|
34
|
-
height: '30px',
|
35
|
-
cursor: "pointer"
|
36
|
-
}}><img width={"100%"} height={"100%"} style={{
|
37
|
-
objectFit: "contain"
|
38
|
-
}} src={!isCopied ? copyIcon : tickIcon} /></button>
|
39
|
-
</div>
|
40
|
-
)
|
41
|
-
}
|
1
|
+
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
|
2
|
+
import { atomDark } from 'react-syntax-highlighter/dist/esm/styles/prism';
|
3
|
+
import copyIcon from '../assets/copy.png'
|
4
|
+
import tickIcon from '../assets/tick.png'
|
5
|
+
import { useState } from 'react';
|
6
|
+
import * as React from 'react';
|
7
|
+
const CodeBlock = ({ code }: { code: string }) => {
|
8
|
+
const [isCopied, setIsCopied] = useState(false);
|
9
|
+
const copyToClipboard = () => {
|
10
|
+
navigator.clipboard.writeText(code);
|
11
|
+
setIsCopied(true);
|
12
|
+
setTimeout(() => {
|
13
|
+
setIsCopied(false);
|
14
|
+
}, 1000);
|
15
|
+
}
|
16
|
+
return (
|
17
|
+
<div style={{
|
18
|
+
display:"flex",
|
19
|
+
alignItems:'start',
|
20
|
+
justifyContent:"space-between",
|
21
|
+
padding:"5px",
|
22
|
+
borderRadius:"5px",
|
23
|
+
color:"white",
|
24
|
+
fontFamily:"Arial, sans-serif",
|
25
|
+
fontSize:"18px",
|
26
|
+
backgroundColor:'rgb(29, 31, 33)',
|
27
|
+
width:"40%",
|
28
|
+
}}>
|
29
|
+
<SyntaxHighlighter language="javascript" style={atomDark}>
|
30
|
+
{code}
|
31
|
+
</SyntaxHighlighter>
|
32
|
+
<button onClick={() => copyToClipboard()} style={{
|
33
|
+
width: "30px",
|
34
|
+
height: '30px',
|
35
|
+
cursor: "pointer"
|
36
|
+
}}><img width={"100%"} height={"100%"} style={{
|
37
|
+
objectFit: "contain"
|
38
|
+
}} src={!isCopied ? copyIcon : tickIcon} /></button>
|
39
|
+
</div>
|
40
|
+
)
|
41
|
+
}
|
42
42
|
export {CodeBlock}
|
@@ -0,0 +1,201 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { useState } from "react";
|
3
|
+
import copyIcon from "../assets/copy.png";
|
4
|
+
import tickIcon from "../assets/tick.png";
|
5
|
+
|
6
|
+
type TypeProp =
|
7
|
+
| "dark"
|
8
|
+
| "light"
|
9
|
+
| "basic"
|
10
|
+
| "blue"
|
11
|
+
| "green"
|
12
|
+
| "purple"
|
13
|
+
| "orange"
|
14
|
+
| "red"
|
15
|
+
| "yellow"
|
16
|
+
| "teal";
|
17
|
+
|
18
|
+
interface props {
|
19
|
+
command: string;
|
20
|
+
type: TypeProp;
|
21
|
+
width?: string;
|
22
|
+
height?: string;
|
23
|
+
title?: string;
|
24
|
+
}
|
25
|
+
|
26
|
+
const OneLineBlock = ({
|
27
|
+
command,
|
28
|
+
type,
|
29
|
+
width = "400",
|
30
|
+
height = "0",
|
31
|
+
title = "Terminal",
|
32
|
+
}: props) => {
|
33
|
+
const [isCopied, setIsCopied] = useState(false);
|
34
|
+
|
35
|
+
const copyToClipboard = () => {
|
36
|
+
navigator.clipboard.writeText(command);
|
37
|
+
setIsCopied(true);
|
38
|
+
setTimeout(() => {
|
39
|
+
setIsCopied(false);
|
40
|
+
}, 1000);
|
41
|
+
};
|
42
|
+
|
43
|
+
const colorScheme = {
|
44
|
+
dark: {
|
45
|
+
background: "#1A1B26",
|
46
|
+
text: "#A3E635",
|
47
|
+
highlight: "#7dd3fc",
|
48
|
+
border: "1px solid #2D3748",
|
49
|
+
},
|
50
|
+
light: {
|
51
|
+
background: "#f8fafc",
|
52
|
+
text: "#334155",
|
53
|
+
highlight: "#2563eb",
|
54
|
+
border: "1px solid #94a3b8",
|
55
|
+
},
|
56
|
+
basic: {
|
57
|
+
background: "#272822",
|
58
|
+
text: "#F8F8F2",
|
59
|
+
highlight: "#66D9EF",
|
60
|
+
border: "1px solid #A6E22E",
|
61
|
+
},
|
62
|
+
blue: {
|
63
|
+
background: "#1E3A8A",
|
64
|
+
text: "#BFDBFE",
|
65
|
+
highlight: "#3B82F6",
|
66
|
+
border: "1px solid #60A5FA",
|
67
|
+
},
|
68
|
+
green: {
|
69
|
+
background: "#064E3B",
|
70
|
+
text: "#D1FAE5",
|
71
|
+
highlight: "#10B981",
|
72
|
+
border: "1px solid #22D3EE",
|
73
|
+
},
|
74
|
+
purple: {
|
75
|
+
background: "#4C1D95",
|
76
|
+
text: "#E9D5FF",
|
77
|
+
highlight: "#A78BFA",
|
78
|
+
border: "1px solid #C084FC",
|
79
|
+
},
|
80
|
+
orange: {
|
81
|
+
background: "#7C2D12",
|
82
|
+
text: "#FFEDD5",
|
83
|
+
highlight: "#FB923C",
|
84
|
+
border: "1px solid #F97316",
|
85
|
+
},
|
86
|
+
red: {
|
87
|
+
background: "#7F1D1D",
|
88
|
+
text: "#FFE4E6",
|
89
|
+
highlight: "#EF4444",
|
90
|
+
border: "1px solid #F87171",
|
91
|
+
},
|
92
|
+
yellow: {
|
93
|
+
background: "#78350F",
|
94
|
+
text: "#FEF9C3",
|
95
|
+
highlight: "#FACC15",
|
96
|
+
border: "1px solid #FBBF24",
|
97
|
+
},
|
98
|
+
teal: {
|
99
|
+
background: "#134E4A",
|
100
|
+
text: "#CCFBF1",
|
101
|
+
highlight: "#14B8A6",
|
102
|
+
border: "1px solid #2DD4BF",
|
103
|
+
},
|
104
|
+
};
|
105
|
+
|
106
|
+
const colors = colorScheme[type];
|
107
|
+
|
108
|
+
return (
|
109
|
+
<div
|
110
|
+
style={{
|
111
|
+
width: width + "px",
|
112
|
+
background: colors.background,
|
113
|
+
display: "flex",
|
114
|
+
flexDirection: "column",
|
115
|
+
padding: "2px",
|
116
|
+
borderRadius: "5px",
|
117
|
+
color: colors.text,
|
118
|
+
fontFamily: "Arial, sans-serif",
|
119
|
+
fontSize: "18px",
|
120
|
+
fontWeight: "bold",
|
121
|
+
}}
|
122
|
+
>
|
123
|
+
<div
|
124
|
+
style={{
|
125
|
+
height: "50px",
|
126
|
+
display: "flex",
|
127
|
+
justifyContent: "space-between",
|
128
|
+
alignItems: "center",
|
129
|
+
borderBottom: colors.border,
|
130
|
+
padding: "5px",
|
131
|
+
}}
|
132
|
+
>
|
133
|
+
<p
|
134
|
+
style={{
|
135
|
+
color: colors.highlight,
|
136
|
+
fontSize: "20px",
|
137
|
+
padding: "5px",
|
138
|
+
fontWeight: "lighter",
|
139
|
+
}}
|
140
|
+
>
|
141
|
+
{title}
|
142
|
+
</p>
|
143
|
+
<button
|
144
|
+
onClick={() => copyToClipboard()}
|
145
|
+
style={{
|
146
|
+
width: "30px",
|
147
|
+
height: "30px",
|
148
|
+
cursor: "pointer",
|
149
|
+
background: "none",
|
150
|
+
border: "none",
|
151
|
+
}}
|
152
|
+
>
|
153
|
+
<img
|
154
|
+
width={"100%"}
|
155
|
+
height={"100%"}
|
156
|
+
style={{
|
157
|
+
objectFit: "contain",
|
158
|
+
}}
|
159
|
+
src={!isCopied ? copyIcon : tickIcon}
|
160
|
+
alt={isCopied ? "Copied" : "Copy"}
|
161
|
+
/>
|
162
|
+
</button>
|
163
|
+
</div>
|
164
|
+
<div
|
165
|
+
style={{
|
166
|
+
display: "flex",
|
167
|
+
alignItems: "center",
|
168
|
+
gap: "10px",
|
169
|
+
}}
|
170
|
+
>
|
171
|
+
<span className="icon">
|
172
|
+
<svg
|
173
|
+
viewBox="0 0 24 24"
|
174
|
+
fill={colors.highlight}
|
175
|
+
height="13"
|
176
|
+
width="13"
|
177
|
+
xmlns="http://www.w3.org/2000/svg"
|
178
|
+
aria-hidden="true"
|
179
|
+
>
|
180
|
+
<path
|
181
|
+
d="m9 5 7 7-7 7"
|
182
|
+
strokeWidth="3"
|
183
|
+
strokeLinejoin="round"
|
184
|
+
strokeLinecap="round"
|
185
|
+
stroke="currentColor"
|
186
|
+
></path>
|
187
|
+
</svg>
|
188
|
+
</span>
|
189
|
+
<p
|
190
|
+
style={{
|
191
|
+
fontFamily: "monospace",
|
192
|
+
}}
|
193
|
+
>
|
194
|
+
{command}
|
195
|
+
</p>
|
196
|
+
</div>
|
197
|
+
</div>
|
198
|
+
);
|
199
|
+
};
|
200
|
+
|
201
|
+
export { OneLineBlock };
|
package/src/index.ts
CHANGED
package/tsconfig.json
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
{
|
2
|
-
"compilerOptions": {
|
3
|
-
"jsx": "react",
|
4
|
-
"target": "ES2020",
|
5
|
-
"module": "ESNext",
|
6
|
-
"declaration": true,
|
7
|
-
"declarationDir": "dist",
|
8
|
-
"strict": true,
|
9
|
-
"moduleResolution": "node",
|
10
|
-
}
|
1
|
+
{
|
2
|
+
"compilerOptions": {
|
3
|
+
"jsx": "react",
|
4
|
+
"target": "ES2020",
|
5
|
+
"module": "ESNext",
|
6
|
+
"declaration": true,
|
7
|
+
"declarationDir": "dist",
|
8
|
+
"strict": true,
|
9
|
+
"moduleResolution": "node",
|
10
|
+
}
|
11
11
|
}
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import * as React from 'react'
|
2
|
-
import { UseCounter } from '../hooks/counter'
|
3
|
-
|
4
|
-
const Increment = () => {
|
5
|
-
const { increment} = UseCounter();
|
6
|
-
return (
|
7
|
-
<button onClick={increment}>Increment</button>
|
8
|
-
)
|
9
|
-
}
|
10
|
-
|
11
|
-
|
12
|
-
const Decrement = () => {
|
13
|
-
const { decrement} = UseCounter();
|
14
|
-
return (
|
15
|
-
<button onClick={decrement}>Decrement</button>
|
16
|
-
)
|
17
|
-
}
|
18
|
-
|
19
|
-
export { Decrement, Increment }
|
@@ -1,88 +0,0 @@
|
|
1
|
-
import * as React from 'react'
|
2
|
-
import { useState } from 'react'
|
3
|
-
import copyIcon from '../assets/copy.png'
|
4
|
-
import tickIcon from '../assets/tick.png'
|
5
|
-
const OneLineBlock = ({ command }: { command: string }) => {
|
6
|
-
const [isCopied, setIsCopied] = useState(false);
|
7
|
-
const copyToClipboard = () => {
|
8
|
-
navigator.clipboard.writeText(command);
|
9
|
-
setIsCopied(true);
|
10
|
-
setTimeout(() => {
|
11
|
-
setIsCopied(false);
|
12
|
-
}, 1000);
|
13
|
-
}
|
14
|
-
return (
|
15
|
-
|
16
|
-
<div style={{
|
17
|
-
width: "400px",
|
18
|
-
background: '#1e293b',
|
19
|
-
display: 'flex',
|
20
|
-
flexDirection: "column",
|
21
|
-
// justifyItems: "center",
|
22
|
-
padding: "2px",
|
23
|
-
borderRadius: "5px",
|
24
|
-
color: "white",
|
25
|
-
fontFamily: "Arial, sans-serif",
|
26
|
-
fontSize: "18px",
|
27
|
-
fontWeight: "bold",
|
28
|
-
|
29
|
-
}}>
|
30
|
-
<div style={{
|
31
|
-
height: '50px',
|
32
|
-
display: 'flex',
|
33
|
-
justifyContent: "space-between",
|
34
|
-
border: "1px ",
|
35
|
-
alignItems: "center",
|
36
|
-
borderBottom: "1px solid white",
|
37
|
-
padding: '5px'
|
38
|
-
}}>
|
39
|
-
<p style={{
|
40
|
-
color: "#7dd3fc",
|
41
|
-
fontSize: '20px',
|
42
|
-
padding: "5px",
|
43
|
-
fontWeight: 'lighter'
|
44
|
-
}}>Terminal</p>
|
45
|
-
<button onClick={() => copyToClipboard()} style={{
|
46
|
-
width: "30px",
|
47
|
-
height: '30px',
|
48
|
-
cursor:"pointer"
|
49
|
-
}}><img width={"100%"} height={"100%"} style={{
|
50
|
-
objectFit: "contain"
|
51
|
-
}} src={!isCopied ? copyIcon : tickIcon} /></button>
|
52
|
-
</div>
|
53
|
-
<div style={{
|
54
|
-
display: "flex",
|
55
|
-
alignItems: "center",
|
56
|
-
gap: "10px"
|
57
|
-
|
58
|
-
}}>
|
59
|
-
<span className="icon">
|
60
|
-
<svg
|
61
|
-
viewBox="0 0 24 24"
|
62
|
-
fill="#7dd3fc"
|
63
|
-
color='#7dd3fc'
|
64
|
-
height="1 3"
|
65
|
-
width="13"
|
66
|
-
xmlns="http://www.w3.org/2000/svg"
|
67
|
-
aria-hidden="true"
|
68
|
-
className="w-[19px] h-[19px] text-gray-800 dark:text-white"
|
69
|
-
>
|
70
|
-
<path
|
71
|
-
d="m9 5 7 7-7 7"
|
72
|
-
stroke-width="3"
|
73
|
-
stroke-linejoin="round"
|
74
|
-
stroke-linecap="round"
|
75
|
-
stroke="currentColor"
|
76
|
-
></path>
|
77
|
-
</svg>
|
78
|
-
</span>
|
79
|
-
<p style={{
|
80
|
-
fontFamily: "monospace"
|
81
|
-
}}>{command}</p>
|
82
|
-
</div>
|
83
|
-
</div>
|
84
|
-
|
85
|
-
)
|
86
|
-
}
|
87
|
-
|
88
|
-
export {OneLineBlock}
|
package/src/hooks/counter.tsx
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
import { useState } from 'react'
|
2
|
-
|
3
|
-
const UseCounter = () => {
|
4
|
-
const [count, setCount] = useState(0)
|
5
|
-
|
6
|
-
const increment = () => {
|
7
|
-
setCount(count + 1)
|
8
|
-
}
|
9
|
-
|
10
|
-
const decrement = () => {
|
11
|
-
setCount(count - 1)
|
12
|
-
}
|
13
|
-
|
14
|
-
return { increment, decrement, count }
|
15
|
-
|
16
|
-
}
|
17
|
-
|
18
|
-
export { UseCounter };
|