Skip to content

Commit e9b9c14

Browse files
committed
chore: fix demo code
1 parent fb02a6d commit e9b9c14

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

.npmignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ demo/
1313
test/
1414
Makefile
1515
README.md
16-
rollup.config.js
1716
jest.config.js
1817
tsconfig.json
1918
.github/

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ lint-fix:
88
@echo "Fix linting..."
99
@npx eslint --fix .
1010
dev:
11-
@echo "Start server..."
11+
@echo "Starting server..."
1212
@NODE_ENV=development npx webpack-dev-server --config ./webpack/demo.js --progress
1313
.PHONY: lint lint-fix dev
1414

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ The options can be passed into genConfig or as React props
107107
```
108108
4. Open the browser to reivew the demo:
109109
```sh
110-
$ open http://localhost:5555
110+
$ open http://localhost:8080
111111
```
112112
5. Edit the files inside [src](/src).
113113

demo/src/App/AvatarEditor/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,12 @@ export default class AvatarEditor extends Component {
6767
}
6868

6969
genCodeString (config) {
70+
const ignoreAttr = ['id']
71+
const myConfig = Object.keys(config)
72+
.filter(key => !ignoreAttr.includes(key))
73+
.reduce((acc, key) => ({ ...acc, [key]: config[key] }), {})
7074
return "const config = " +
71-
JSON.stringify(config, null, 2) +
75+
JSON.stringify(myConfig, null, 2) +
7276
"\n" +
7377
"const myConfig = genConfig(config)\n" +
7478
"<NiceAvatar style={{ width: '5rem', height: '5rem' }} {...myConfig} />"

0 commit comments

Comments
 (0)