auto-component 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/auto-component.jsx +16 -7
package/package.json
CHANGED
package/src/auto-component.jsx
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { useState, useEffect } from 'react'
|
|
2
2
|
import beautify from 'js-beautify'
|
|
3
|
-
import
|
|
4
|
-
import './Componenter.css'
|
|
3
|
+
import './auto-component.css'
|
|
5
4
|
|
|
6
|
-
const
|
|
5
|
+
const AutoComponent = () => {
|
|
7
6
|
|
|
8
7
|
//**-----------**/
|
|
9
8
|
// ** State ** //
|
|
@@ -16,6 +15,11 @@ const Componenter = ({ exclusions }) => {
|
|
|
16
15
|
const [ requestData, setRequestData ] = useState(null)
|
|
17
16
|
|
|
18
17
|
const [ activeTab, setActiveTab ] = useState('request')
|
|
18
|
+
|
|
19
|
+
// test response
|
|
20
|
+
const response = {
|
|
21
|
+
html: `{projects.map((project, index) => (<div key={index} style={{ border: '1px solid #ccc', padding: '16px', marginBottom: '16px', display: 'flex', flexDirection: 'column', alignItems: 'center' }}><h3>{project.title}</h3><p>{project.description}</p><div style={{ display: 'flex', justifyContent: 'space-between', width: '100%' }}>{project.images.map((image, imgIndex) => (<img key={imgIndex} src={image} alt={\`Project Image \${imgIndex + 1}\`} style={{ width: '100%', maxWidth: '150px', marginBottom: '8px' }} />))}</div><div style={{ display: 'flex', justifyContent: 'space-between', width: '100%' }}><a href={project.gitLink} style={{ color: 'blue' }}>GitHub</a><a href={project.deployLink} style={{ color: 'green' }}>Deployed</a></div></div>))}`
|
|
22
|
+
}
|
|
19
23
|
|
|
20
24
|
//**-------------------------**/
|
|
21
25
|
// ** HTML/CSS Formatting ** //
|
|
@@ -106,9 +110,9 @@ const Componenter = ({ exclusions }) => {
|
|
|
106
110
|
setIsLoading(false)
|
|
107
111
|
}
|
|
108
112
|
|
|
109
|
-
|
|
110
|
-
// ** UI Handling ** //
|
|
111
|
-
|
|
113
|
+
//**------------------------**/
|
|
114
|
+
// ** UI/Button Handling ** //
|
|
115
|
+
//**----------------------**/
|
|
112
116
|
|
|
113
117
|
const handleChange = (e) => {
|
|
114
118
|
e.preventDefault()
|
|
@@ -134,6 +138,11 @@ const Componenter = ({ exclusions }) => {
|
|
|
134
138
|
const handleResponseTab = () => {
|
|
135
139
|
setActiveTab('response')
|
|
136
140
|
}
|
|
141
|
+
|
|
142
|
+
const copyToClipboard = async () => {
|
|
143
|
+
const text = activeTab
|
|
144
|
+
await navigator.clipboard.writeText(text)
|
|
145
|
+
}
|
|
137
146
|
|
|
138
147
|
//**---------------**/
|
|
139
148
|
// ** Rendering ** //
|
|
@@ -185,4 +194,4 @@ const Componenter = ({ exclusions }) => {
|
|
|
185
194
|
)
|
|
186
195
|
}
|
|
187
196
|
|
|
188
|
-
export default
|
|
197
|
+
export default AutoComponent
|