|
1 |
| -# @lemoncode/react-image-focal-point |
| 1 | +<div align="center"> |
| 2 | + <h1>React Image Focal Point</h1> |
| 3 | + <a href="https://lemoncode.github.io/react-image-focal-point"> |
| 4 | + <img |
| 5 | + height="100" |
| 6 | + width="100" |
| 7 | + alt="logo" |
| 8 | + src="https://raw.githubusercontent.com/lemoncode/react-image-focal-point/main/website/static/img/logo.svg" |
| 9 | + /> |
| 10 | + </a> |
| 11 | + |
| 12 | + <br/> |
| 13 | + |
| 14 | + <p>Let the user set the picture focal point just by visually dragging and dropping on top of the selected image.</p> |
| 15 | + |
| 16 | + <h2>Live Demo</h2> |
| 17 | + <br/> |
| 18 | + <a target="_blank" href="https://stackblitz.com/github/Lemoncode/react-image-focal-point/tree/main/examples/basic"> |
| 19 | + <img |
| 20 | + src="https://developer.stackblitz.com/img/open_in_stackblitz.svg" |
| 21 | + alt="Edit on StackBlitz" |
| 22 | + title="Edit on StackBlitz" |
| 23 | + height="36" |
| 24 | + /> |
| 25 | +</a> <a target="_blank" href="https://codesandbox.io/s/github/Lemoncode/react-image-focal-point/tree/main/examples/basic"> |
| 26 | + <img |
| 27 | + src="https://codesandbox.io/static/img/play-codesandbox.svg" |
| 28 | + alt="Edit on Codesandbox" |
| 29 | + title="Edit on Codesandbox" |
| 30 | + height="36" |
| 31 | + /> |
| 32 | + </a> |
| 33 | + |
| 34 | + <br /> |
| 35 | + <br /> |
| 36 | + |
| 37 | +Video tutorial comming soon |
| 38 | + |
| 39 | +</div> |
| 40 | + |
| 41 | +<hr /> |
| 42 | + |
| 43 | +    |
| 44 | + |
| 45 | +    |
| 46 | + |
| 47 | +   |
| 48 | + |
| 49 | +## Table of Contents |
| 50 | + |
| 51 | +- [Installation](#installation) |
| 52 | +- [Quickstart](#quickstart) |
| 53 | +- [Docs](#docs) |
| 54 | +- [Examples](#examples) |
| 55 | +- [Key Features](#key-features) |
| 56 | + |
| 57 | +## Installation |
| 58 | + |
| 59 | +Install _React Image Focal Point_ using your favorite package manager like [npm](https://www.npmjs.com/): |
| 60 | + |
| 61 | +```bash |
| 62 | +npm install @lemoncode/react-image-focal-point |
| 63 | + |
| 64 | +``` |
| 65 | + |
| 66 | +or via [yarn](https://classic.yarnpkg.com/lang/en/): |
| 67 | + |
| 68 | +```bash |
| 69 | +yarn add @lemoncode/react-image-focal-point |
| 70 | + |
| 71 | +``` |
| 72 | + |
| 73 | +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. |
| 74 | + |
| 75 | +## Quickstart |
| 76 | + |
| 77 | +Import the library styles and the component: |
| 78 | + |
| 79 | +```jsx |
| 80 | +import '@lemoncode/react-image-focal-point/style.css'; |
| 81 | +import { ImageFocalPoint } from '@lemoncode/react-image-focal-point'; |
| 82 | + |
| 83 | +const App = () => { |
| 84 | + return ( |
| 85 | + // Your app code |
| 86 | + ); |
| 87 | +}; |
| 88 | + |
| 89 | +``` |
| 90 | + |
| 91 | +Then use the component: |
| 92 | + |
| 93 | +```jsx |
| 94 | +import '@lemoncode/react-image-focal-point/style.css'; |
| 95 | +import { ImageFocalPoint } from '@lemoncode/react-image-focal-point'; |
| 96 | + |
| 97 | +const App = () => { |
| 98 | + return ( |
| 99 | + <ImageFocalPoint |
| 100 | + src="your-image-src" // Same src as <img> HTML element |
| 101 | + onChange={focalPoint => { |
| 102 | + // Add here your code to do whatever you want to when the user drags on the focal point |
| 103 | + }} |
| 104 | + /> |
| 105 | + ); |
| 106 | +}; |
| 107 | +``` |
| 108 | + |
| 109 | +## Docs |
| 110 | + |
| 111 | +Check out our official [documentation](https://lemoncode.github.io/react-image-focal-point) |
| 112 | + |
| 113 | +## Examples |
| 114 | + |
| 115 | +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). |
| 116 | + |
| 117 | +## Key Features |
| 118 | + |
| 119 | +- Let the user set the picture focal point just by visually dragging and dropping on top of the selected image. |
| 120 | + |
| 121 | +- You can use it as a controlled or uncontrolled component. |
| 122 | + |
| 123 | +- You can style the component at any component's level (check out the [docs site CSS section](https://lemoncode.github.io/react-image-focal-point/docs/api/image-focal-point#classesprops)). |
| 124 | + |
| 125 | +# About Lemoncode + Basefactor |
| 126 | + |
| 127 | +We are an innovating team of Javascript experts, passionate about turning your ideas into robust products. |
| 128 | + |
| 129 | +[Lemoncode](http://lemoncode.net/services/en/#en-home) provides training services. |
| 130 | + |
| 131 | +[Basefactor, consultancy by Lemoncode](http://www.basefactor.com) provides consultancy and coaching services. |
| 132 | + |
| 133 | +For the LATAM/Spanish audience we are running an Online Front End Master degree, more info: http://lemoncode.net/master-frontend |
0 commit comments