@avatar-generator/react 1.0.0
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/dist/Avatar.js +13 -0
- package/dist/index.js +1 -0
- package/dist/types/Avatar.d.ts +4 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +18 -0
- package/src/Avatar.tsx +17 -0
- package/src/index.ts +1 -0
- package/tsconfig.json +14 -0
package/dist/Avatar.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { createAvatar } from "@avatar-generator/core";
|
|
3
|
+
const Avatar = (props) => {
|
|
4
|
+
const ref = React.useRef(null);
|
|
5
|
+
React.useEffect(() => {
|
|
6
|
+
if (ref.current) {
|
|
7
|
+
ref.current.innerHTML = "";
|
|
8
|
+
ref.current.appendChild(createAvatar(props));
|
|
9
|
+
}
|
|
10
|
+
}, [props]);
|
|
11
|
+
return React.createElement("div", { ref: ref });
|
|
12
|
+
};
|
|
13
|
+
export default Avatar;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Avatar } from "./Avatar";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Avatar } from "./Avatar";
|
package/package.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@avatar-generator/react",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/types/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"prepublishOnly": "npm run build"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@avatar-generator/core": "^1.0.0",
|
|
13
|
+
"react": "^17.0.0"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@types/react": "^17.0.0"
|
|
17
|
+
}
|
|
18
|
+
}
|
package/src/Avatar.tsx
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { createAvatar, AvatarOptions } from "@avatar-generator/core";
|
|
3
|
+
|
|
4
|
+
const Avatar: React.FC<AvatarOptions> = (props) => {
|
|
5
|
+
const ref = React.useRef<HTMLDivElement>(null);
|
|
6
|
+
|
|
7
|
+
React.useEffect(() => {
|
|
8
|
+
if (ref.current) {
|
|
9
|
+
ref.current.innerHTML = "";
|
|
10
|
+
ref.current.appendChild(createAvatar(props));
|
|
11
|
+
}
|
|
12
|
+
}, [props]);
|
|
13
|
+
|
|
14
|
+
return <div ref={ref} />;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default Avatar;
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Avatar } from "./Avatar";
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"jsx": "react",
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"declarationDir": "./dist/types",
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"module": "ESNext",
|
|
9
|
+
"moduleResolution": "Node",
|
|
10
|
+
"target": "ESNext",
|
|
11
|
+
"rootDir": "src"
|
|
12
|
+
},
|
|
13
|
+
"include": ["src"]
|
|
14
|
+
}
|