ehscan-react-components 0.1.41 → 0.1.43
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/README.md +29 -31
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,43 +15,41 @@ AddBox is a React component for managing a list of entries. It allows users to a
|
|
|
15
15
|
|
|
16
16
|
The component is fully controlled — the parent manages the state and receives updates via the onChange callback.
|
|
17
17
|
|
|
18
|
-

|
|
19
|
+
|
|
19
20
|
|
|
20
21
|
### Implementation
|
|
21
22
|
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
```jsx
|
|
24
|
+
import { useEffect, useState } from "react";
|
|
25
|
+
import { AddBox, useChangeAddBox } from 'ehscan-react-components';
|
|
25
26
|
|
|
26
|
-
|
|
27
|
+
const Elements = () => {
|
|
27
28
|
|
|
28
29
|
const [inValue, setInValue] = useState({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export default Elements;
|
|
30
|
+
add: [
|
|
31
|
+
{ id: 0, title: "first Entry" },
|
|
32
|
+
{ id: 1, title: "second Entry" },
|
|
33
|
+
{ id: 2, title: "last Entry" }
|
|
34
|
+
]
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
console.log(inValue); //use ValueChanges on save
|
|
39
|
+
},[inValue])
|
|
40
|
+
|
|
41
|
+
const changeAddBox = useChangeAddBox(inValue, setInValue, "add"); //change on specific tag
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<>
|
|
45
|
+
<div className="element-wrapper"> {/* ✏️ Put custom styling overrides here */}
|
|
46
|
+
<AddBox title="Element-Title" value={inValue.add} onChange={(value, id) => changeAddBox(value, id)} />
|
|
47
|
+
</div>
|
|
48
|
+
</>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export default Elements;
|
|
55
53
|
```
|
|
56
54
|
|
|
57
55
|
### Styling
|