Skip to content

Commit 23a1ac5

Browse files
committed
update imports
1 parent beb3b7c commit 23a1ac5

File tree

5 files changed

+45
-36
lines changed

5 files changed

+45
-36
lines changed

docs/examples/basic-with-apply.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
title: Basic example, apply button
33
---
44

5+
import Tabs from '@theme/Tabs';
6+
import TabItem from '@theme/TabItem';
7+
58
This example is quite similar to the [basic example](basic), but instead of applying the changes real time, the user has to click on an 'apply' button to see the updates reflected.
69

710
## Live example
811

9-
import Tabs from '@theme/Tabs';
10-
import TabItem from '@theme/TabItem';
11-
1212
<Tabs
1313
defaultValue="codesandbox"
1414
values={[

docs/examples/basic.mdx

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,20 @@
22
title: Basic
33
---
44

5+
import Tabs from '@theme/Tabs';
6+
import TabItem from '@theme/TabItem';
7+
58
Minimum example, here you can just drag the focal point and the example pictures focal point will be updated on real time.
69

710
## How to apply this feature in your code
811

912
Import the library styles and the component:
1013

11-
```jsx
14+
```jsx title="app.tsx" showLineNumbers
15+
// highlight-start
1216
import '@lemoncode/react-image-focal-point/style.css';
1317
import { ImageFocalPoint } from '@lemoncode/react-image-focal-point';
18+
// highlight-end
1419

1520
const App = () => {
1621
return (
@@ -22,28 +27,26 @@ const App = () => {
2227

2328
Then use the component:
2429

25-
```diff
30+
```jsx title="app.tsx" showLineNumbers
2631
import '@lemoncode/react-image-focal-point/style.css';
2732
import { ImageFocalPoint } from '@lemoncode/react-image-focal-point';
2833

2934
const App = () => {
3035
return (
31-
+ <ImageFocalPoint
32-
+ src="your-image-src"
33-
+ onChange={(focalPoint) => {
34-
+ // Whatever you want to do when the user clicks on the image
35-
+ }}
36-
+ />
36+
// highlight-start
37+
<ImageFocalPoint
38+
src="your-image-src"
39+
onChange={focalPoint => {
40+
// Whatever you want to do when the user clicks on the image
41+
}}
42+
/>
43+
// highlight-end
3744
);
38-
}
39-
45+
};
4046
```
4147

4248
## Live example
4349

44-
import Tabs from '@theme/Tabs';
45-
import TabItem from '@theme/TabItem';
46-
4750
<Tabs
4851
defaultValue="codesandbox"
4952
values={[

docs/examples/controlled.mdx

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,54 +2,60 @@
22
title: Controlled
33
---
44

5+
import Tabs from '@theme/Tabs';
6+
import TabItem from '@theme/TabItem';
7+
58
In this example you can check how to set an initial focal point value (by default it is show centered, but you can override it).
69

710
## How to apply this feature in your code
811

912
Import the library styles and the component. Use it with minimal properties:
1013

11-
```jsx
14+
```jsx title="app.tsx" showLineNumbers
15+
// highlight-start
1216
import '@lemoncode/react-image-focal-point/style.css';
1317
import { ImageFocalPoint } from '@lemoncode/react-image-focal-point';
18+
// highlight-end
1419

1520
const App = () => {
1621
return (
22+
// highlight-start
1723
<ImageFocalPoint
1824
src="your-image-src"
1925
onChange={newFocalPoint => {
2026
// Whatever you want to do when the user clicks on the image
2127
}}
2228
/>
29+
// highlight-end
2330
);
2431
};
2532
```
2633

2734
Create a state to provide the initial focal point values and store the new ones:
2835

29-
```diff
36+
```jsx title="app.tsx" showLineNumbers
3037
import '@lemoncode/react-image-focal-point/style.css';
3138
import { ImageFocalPoint } from '@lemoncode/react-image-focal-point';
3239

3340
const App = () => {
34-
+ const [focalPoint, setFocalPoint] = useState({ x: 5, y: 10 });
41+
// highlight-next-line
42+
const [focalPoint, setFocalPoint] = useState({ x: 5, y: 10 });
3543
return (
3644
<ImageFocalPoint
37-
src="your-image-src"
38-
+ focalPoint={focalPoint}
39-
onChange={(newFocalPoint) => {
40-
+ setFocalPoint(newFocalPoint);
41-
}}
42-
/>
45+
src="your-image-src"
46+
// highlight-next-line
47+
focalPoint={focalPoint}
48+
onChange={newFocalPoint => {
49+
// highlight-next-line
50+
setFocalPoint(newFocalPoint);
51+
}}
52+
/>
4353
);
44-
}
45-
54+
};
4655
```
4756

4857
## Live example
4958

50-
import Tabs from '@theme/Tabs';
51-
import TabItem from '@theme/TabItem';
52-
5359
<Tabs
5460
defaultValue="codesandbox"
5561
values={[

docs/examples/styled.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
title: Styled
33
---
44

5+
import Tabs from '@theme/Tabs';
6+
import TabItem from '@theme/TabItem';
7+
58
This example shows how to provide styles to the image focal point component.
69

710
## How to apply this feature in your code
@@ -106,9 +109,6 @@ const App = () => {
106109
107110
## Live example
108111

109-
import Tabs from '@theme/Tabs';
110-
import TabItem from '@theme/TabItem';
111-
112112
<Tabs
113113
defaultValue="codesandbox"
114114
values={[

docs/examples/webpack-entry-point.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
title: Webpack entry point
33
---
44

5+
import Tabs from '@theme/Tabs';
6+
import TabItem from '@theme/TabItem';
7+
58
This example is the same as the [basic example](basic), but using the webpack entry point to import the library styles.
69

710
## How to apply this feature in your code
@@ -40,9 +43,6 @@ module.exports = {
4043

4144
## Live example
4245

43-
import Tabs from '@theme/Tabs';
44-
import TabItem from '@theme/TabItem';
45-
4646
<Tabs
4747
defaultValue="codesandbox"
4848
values={[

0 commit comments

Comments
 (0)