opsnippets 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/assets.d.ts +6 -0
- package/dist/components/Button.d.ts +4 -0
- package/dist/components/CodeBlock.d.ts +5 -0
- package/dist/components/OneLineComand.d.ts +5 -0
- package/dist/hooks/counter.d.ts +6 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +120 -0
- package/package.json +28 -0
- package/rollup.config.js +22 -0
- package/src/assets/copy.png +0 -0
- package/src/assets/tick.png +0 -0
- package/src/components/Button.tsx +19 -0
- package/src/components/CodeBlock.tsx +42 -0
- package/src/components/OneLineComand.tsx +88 -0
- package/src/hooks/counter.tsx +18 -0
- package/src/index.ts +4 -0
- package/tsconfig.json +11 -0
package/assets.d.ts
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { useState } from 'react';
|
3
|
+
import { Prism } from 'react-syntax-highlighter';
|
4
|
+
import { atomDark } from 'react-syntax-highlighter/dist/esm/styles/prism';
|
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
|
+
var copyIcon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAAABl0RVh0U29mdHdhcmUAd3d3Lml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Avjv25WUBfDPXgD//38BvfwtgL8F8LcA/hbA3wL4WwB/C+BvAfyzFnC7l78F8LcA/hbA3wL4WwB/C+BvAfwtgL8F8LcA/hbA3wL4WwB/C+BvAfwtgL8F8LcA/hbA3wL4WwB/C+BvAfzbtoCFXv4WwN8C+FsAfwv47/xv8D9JCzjL3wL4WwB/C+BvAfwtgL8F8LcA/hbA3wL4WwB/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
|
+
|
30
|
+
const OneLineBlock = ({ command }) => {
|
31
|
+
const [isCopied, setIsCopied] = useState(false);
|
32
|
+
const copyToClipboard = () => {
|
33
|
+
navigator.clipboard.writeText(command);
|
34
|
+
setIsCopied(true);
|
35
|
+
setTimeout(() => {
|
36
|
+
setIsCopied(false);
|
37
|
+
}, 1000);
|
38
|
+
};
|
39
|
+
return (React.createElement("div", { style: {
|
40
|
+
width: "400px",
|
41
|
+
background: '#1e293b',
|
42
|
+
display: 'flex',
|
43
|
+
flexDirection: "column",
|
44
|
+
// justifyItems: "center",
|
45
|
+
padding: "2px",
|
46
|
+
borderRadius: "5px",
|
47
|
+
color: "white",
|
48
|
+
fontFamily: "Arial, sans-serif",
|
49
|
+
fontSize: "18px",
|
50
|
+
fontWeight: "bold",
|
51
|
+
} },
|
52
|
+
React.createElement("div", { style: {
|
53
|
+
height: '50px',
|
54
|
+
display: 'flex',
|
55
|
+
justifyContent: "space-between",
|
56
|
+
border: "1px ",
|
57
|
+
alignItems: "center",
|
58
|
+
borderBottom: "1px solid white",
|
59
|
+
padding: '5px'
|
60
|
+
} },
|
61
|
+
React.createElement("p", { style: {
|
62
|
+
color: "#7dd3fc",
|
63
|
+
fontSize: '20px',
|
64
|
+
padding: "5px",
|
65
|
+
fontWeight: 'lighter'
|
66
|
+
} }, "Terminal"),
|
67
|
+
React.createElement("button", { onClick: () => copyToClipboard(), style: {
|
68
|
+
width: "30px",
|
69
|
+
height: '30px',
|
70
|
+
cursor: "pointer"
|
71
|
+
} },
|
72
|
+
React.createElement("img", { width: "100%", height: "100%", style: {
|
73
|
+
objectFit: "contain"
|
74
|
+
}, src: !isCopied ? copyIcon : tickIcon }))),
|
75
|
+
React.createElement("div", { style: {
|
76
|
+
display: "flex",
|
77
|
+
alignItems: "center",
|
78
|
+
gap: "10px"
|
79
|
+
} },
|
80
|
+
React.createElement("span", { className: "icon" },
|
81
|
+
React.createElement("svg", { viewBox: "0 0 24 24", fill: "#7dd3fc", color: '#7dd3fc', height: "1 3", width: "13", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", className: "w-[19px] h-[19px] text-gray-800 dark:text-white" },
|
82
|
+
React.createElement("path", { d: "m9 5 7 7-7 7", "stroke-width": "3", "stroke-linejoin": "round", "stroke-linecap": "round", stroke: "currentColor" }))),
|
83
|
+
React.createElement("p", { style: {
|
84
|
+
fontFamily: "monospace"
|
85
|
+
} }, command))));
|
86
|
+
};
|
87
|
+
|
88
|
+
const CodeBlock = ({ code }) => {
|
89
|
+
const [isCopied, setIsCopied] = useState(false);
|
90
|
+
const copyToClipboard = () => {
|
91
|
+
navigator.clipboard.writeText(code);
|
92
|
+
setIsCopied(true);
|
93
|
+
setTimeout(() => {
|
94
|
+
setIsCopied(false);
|
95
|
+
}, 1000);
|
96
|
+
};
|
97
|
+
return (React.createElement("div", { style: {
|
98
|
+
display: "flex",
|
99
|
+
alignItems: 'start',
|
100
|
+
justifyContent: "space-between",
|
101
|
+
padding: "5px",
|
102
|
+
borderRadius: "5px",
|
103
|
+
color: "white",
|
104
|
+
fontFamily: "Arial, sans-serif",
|
105
|
+
fontSize: "18px",
|
106
|
+
backgroundColor: 'rgb(29, 31, 33)',
|
107
|
+
width: "40%",
|
108
|
+
} },
|
109
|
+
React.createElement(Prism, { language: "javascript", style: atomDark }, code),
|
110
|
+
React.createElement("button", { onClick: () => copyToClipboard(), style: {
|
111
|
+
width: "30px",
|
112
|
+
height: '30px',
|
113
|
+
cursor: "pointer"
|
114
|
+
} },
|
115
|
+
React.createElement("img", { width: "100%", height: "100%", style: {
|
116
|
+
objectFit: "contain"
|
117
|
+
}, src: !isCopied ? copyIcon : tickIcon }))));
|
118
|
+
};
|
119
|
+
|
120
|
+
export { CodeBlock, Decrement, Increment, OneLineBlock, UseCounter };
|
package/package.json
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
{
|
2
|
+
"name": "opsnippets",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "",
|
5
|
+
"main": "dist/index.js",
|
6
|
+
"type": "module",
|
7
|
+
"types": "dist/index.d.ts",
|
8
|
+
"scripts": {
|
9
|
+
"build": "npx rollup -c"
|
10
|
+
},
|
11
|
+
"keywords": [],
|
12
|
+
"author": "",
|
13
|
+
"license": "ISC",
|
14
|
+
"devDependencies": {
|
15
|
+
"@rollup/plugin-babel": "^6.0.4",
|
16
|
+
"@rollup/plugin-typescript": "^11.1.6",
|
17
|
+
"@types/react": "^18.3.3",
|
18
|
+
"react": "^18.3.1",
|
19
|
+
"react-dom": "^18.3.1",
|
20
|
+
"rollup": "^4.20.0",
|
21
|
+
"rollup-plugin-url": "^3.0.1",
|
22
|
+
"tslib": "^2.6.3"
|
23
|
+
},
|
24
|
+
"dependencies": {
|
25
|
+
"@types/react-syntax-highlighter": "^15.5.13",
|
26
|
+
"react-syntax-highlighter": "^15.5.0"
|
27
|
+
}
|
28
|
+
}
|
package/rollup.config.js
ADDED
@@ -0,0 +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
|
+
});
|
Binary file
|
Binary file
|
@@ -0,0 +1,19 @@
|
|
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 }
|
@@ -0,0 +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
|
+
}
|
42
|
+
export {CodeBlock}
|
@@ -0,0 +1,88 @@
|
|
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}
|
@@ -0,0 +1,18 @@
|
|
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 };
|
package/src/index.ts
ADDED