From 43b0b1e523659cac2907b66d38bd24ca7d66ce56 Mon Sep 17 00:00:00 2001
From: Maciej Pyrc
Date: Sat, 9 Mar 2024 17:42:26 +0100
Subject: [PATCH] =?UTF-8?q?style:=20=F0=9F=92=84=20Readme=20update?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 144 +++++++++++++++++++++++++++++++++---------------------
1 file changed, 88 insertions(+), 56 deletions(-)
diff --git a/README.md b/README.md
index 0d1bfdd..69faafd 100644
--- a/README.md
+++ b/README.md
@@ -36,14 +36,27 @@
-Do you like this library? Try out other projects
-**[⚡Hyper Fetch](https://github.com/BetterTyped/hyper-fetch)**
-
#### Sources
- [Demo](https://BetterTyped.github.io/react-zoom-pan-pinch/?path=/story/examples-big-image--big-image)
- [Docs](https://BetterTyped.github.io/react-zoom-pan-pinch/?path=/story/docs-props--page)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
## Key Features
- 🚀 Fast and easy to use
@@ -58,6 +71,22 @@ Do you like this library? Try out other projects
- [Become a Sponsor on GitHub](https://github.com/sponsors/prc5)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
---
## Installation
@@ -91,7 +120,23 @@ or
```jsx
import React, { Component } from "react";
-import { TransformWrapper, TransformComponent } from "react-zoom-pan-pinch";
+import {
+ TransformWrapper,
+ TransformComponent,
+ useControls,
+} from "react-zoom-pan-pinch";
+
+const Controls = () => {
+ const { zoomIn, zoomOut, resetTransform } = useControls();
+
+ return (
+
+ zoomIn()}>+
+ zoomOut()}>-
+ resetTransform()}>x
+
+ );
+};
const Example = () => {
return (
@@ -101,72 +146,59 @@ const Example = () => {
initialPositionY={100}
>
{({ zoomIn, zoomOut, resetTransform, ...rest }) => (
-
-
- zoomIn()}>+
- zoomOut()}>-
- resetTransform()}>x
-
+ <>
+
Example text
-
+ >
)}
);
};
```
-or
+
+
+
+
+
+
+
-```tsx
-import React, { useRef } from "react";
-import {
- TransformWrapper,
- TransformComponent,
- ReactZoomPanPinchRef,
-} from "react-zoom-pan-pinch";
+
+
+
+
+
+
+
-const Controls = ({ zoomIn, zoomOut, resetTransform }) => (
- <>
- zoomIn()}>+
- zoomOut()}>-
- resetTransform()}>x
- >
-);
+
+
+
+
+
-const Component = () => {
- const transformComponentRef = useRef(null);
+## License
- const zoomToImage = () => {
- if (transformComponentRef.current) {
- const { zoomToElement } = transformComponentRef.current;
- zoomToElement("imgExample");
- }
- };
+MIT © [prc5](https://github.com/prc5)
- return (
-
- {(utils) => (
-
-
-
-
- Example text
-
-
- )}
-
- );
-};
-```
+## Try other BetterTyped projects
-## License
+Do you like this library? Try out other projects
+**[⚡Hyper Fetch](https://github.com/BetterTyped/hyper-fetch)** - Fetching and
+realtime data exchange framework.
-MIT © [prc5](https://github.com/prc5)
+
+
+
+
+## 💖 Our sponsors
+
+
+
+
+
+