Skip to content

Commit 6154ffa

Browse files
committed
@lemoncode/react-image-focal-point v1.0.0
1 parent 3ff0ef5 commit 6154ffa

File tree

3 files changed

+57
-2
lines changed

3 files changed

+57
-2
lines changed

.changeset/poor-carpets-know.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
'@lemoncode/react-image-focal-point': major
3+
---
4+
5+
Let the user set the picture focal point just by visually dragging and dropping on top of the selected image.
6+
7+
Install _React Image Focal Point_ using your favorite package manager like [npm](https://www.npmjs.com/):
8+
9+
```bash
10+
npm install @lemoncode/react-image-focal-point
11+
12+
```
13+
14+
or via [yarn](https://classic.yarnpkg.com/lang/en/):
15+
16+
```bash
17+
yarn add @lemoncode/react-image-focal-point
18+
19+
```
20+
21+
This library has `peerDependencies` listings for `react` and `react-dom`. You will need to install these packages in your project in order to use this library.
22+
23+
Import the library styles and the component:
24+
25+
```jsx
26+
import '@lemoncode/react-image-focal-point/style.css';
27+
import { ImageFocalPoint } from '@lemoncode/react-image-focal-point';
28+
29+
const App = () => {
30+
return (
31+
// Your app code
32+
);
33+
};
34+
35+
```
36+
37+
Then use the component:
38+
39+
```jsx
40+
import '@lemoncode/react-image-focal-point/style.css';
41+
import { ImageFocalPoint } from '@lemoncode/react-image-focal-point';
42+
43+
const App = () => {
44+
return (
45+
<ImageFocalPoint
46+
src="your-image-src" // Same src as <img> HTML element
47+
onChange={focalPoint => {
48+
// Add here your code to do whatever you want to when the user drags on the focal point
49+
}}
50+
/>
51+
);
52+
};
53+
```
54+
55+
Check out our official [documentation](https://lemoncode.github.io/react-image-focal-point)
56+
57+
You'll find runnable examples in the [docs site](https://lemoncode.github.io/react-image-focal-point/docs/examples/basic) and in the [examples folder](https://github.com/Lemoncode/react-image-focal-point/tree/main/examples).

packages/config/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"name": "@lemoncode/config",
3-
"version": "0.0.0",
43
"private": true,
54
"files": [
65
"test",

website/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"name": "docs-website",
3-
"version": "0.0.0",
43
"private": true,
54
"scripts": {
65
"start": "docusaurus start",

0 commit comments

Comments
 (0)