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.
Files changed (2) hide show
  1. package/README.md +29 -31
  2. 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
- ![AddBox Example](./src/images/AddBox.png)
18
+ ![AddBox Preview](https://raw.githubusercontent.com/beeplaced/ehscan-react-components/main/src/images/AddBox.png)
19
+
19
20
 
20
21
  ### Implementation
21
22
 
22
- ```tsx
23
- import { useEffect, useState } from "react";
24
- import { AddBox, useChangeAddBox } from "ehscan-react-components";
23
+ ```jsx
24
+ import { useEffect, useState } from "react";
25
+ import { AddBox, useChangeAddBox } from 'ehscan-react-components';
25
26
 
26
- const Elements = () => {
27
+ const Elements = () => {
27
28
 
28
29
  const [inValue, setInValue] = useState({
29
- add: [
30
- { id: 0, title: "first Entry" },
31
- { id: 1, title: "second Entry" },
32
- { id: 2, title: "last Entry" }
33
- ]
34
- });
35
-
36
- // Log changes whenever entries are updated
37
- useEffect(() => {
38
- console.log(inValue);
39
- }, [inValue]);
40
-
41
- // Scoped change function for the "add" key
42
- const changeAddBox = useChangeAddBox(inValue, setInValue, "add");
43
-
44
- return (
45
- <div className="element-wrapper">
46
- <AddBox
47
- value={inValue.add}
48
- onChange={(value, id) => changeAddBox(value, id)}
49
- />
50
- </div>
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ehscan-react-components",
3
- "version": "0.1.41",
3
+ "version": "0.1.43",
4
4
  "description": "components",
5
5
  "main": "dist/Components.js",
6
6
  "types": "dist/Components.d.ts",