Skip to content

Commit 0445135

Browse files
committed
feat: add use-hook-readme
1 parent 1edfd3a commit 0445135

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,24 +48,29 @@ yarn add @use-hooks/image-size
4848

4949
```js
5050
import React from 'react';
51+
5152
import useImageSize from '@use-hooks/image-size';
5253

5354
export default function App() {
5455
const url = 'https://cdn.int64ago.org/ogk39i54.png';
55-
5656
const [width, height] = useImageSize(url);
5757

5858
return (
5959
<div>
60-
Natural size: {width} x {height}
60+
<h2>DEMO of <span style={{ color: '#F44336' }}>@use-hooks/image-size</span></h2>
61+
<div>
62+
<img src={url} width={100} height={100} alt="" />
63+
<div>Natural size: {width} x {height}</div>
64+
</div>
6165
</div>
6266
);
6367
}
68+
6469
```
6570

66-
See `./example` for a full [example](https://use-hooks.github.io/react-hooks-image-size/).
71+
[Live Show](https://use-hooks.github.io/react-hooks-image-size/)
6772

68-
## Have a try
73+
## Development
6974

7075
> Node >= v8 LTS
7176

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@use-hooks/image-size",
33
"version": "1.0.0",
4-
"description": "Custom React Hooks for image natural size",
4+
"description": "Custom React Hooks for image natural size.",
55
"main": "dist/index.js",
66
"files": [
77
"dist"
@@ -11,6 +11,7 @@
1111
"start": "webpack-dev-server --progress --color",
1212
"build": "webpack --env build",
1313
"example": "webpack --env example",
14+
"readme": "use-hooks-readme",
1415
"lint": "eslint src example",
1516
"lint:fix": "eslint src example --fix",
1617
"prepublishOnly": "npm run build"
@@ -45,6 +46,7 @@
4546
"jest": "^23.6.0",
4647
"lint-staged": "^8.1.0",
4748
"regenerator-runtime": "^0.13.1",
49+
"use-hooks-readme": "^1.0.1",
4850
"webpack": "^4.27.1",
4951
"webpack-cli": "^3.1.2",
5052
"webpack-dev-server": "^3.1.10"
@@ -58,6 +60,10 @@
5860
"*.{js,jsx}": [
5961
"eslint --fix",
6062
"git add"
63+
],
64+
"*.{js,jsx,json}": [
65+
"use-hooks-readme",
66+
"git add README.md"
6167
]
6268
},
6369
"dependencies": {

0 commit comments

Comments
 (0)