|
1 |
| -import React from 'react'; |
| 1 | +import React, { Component } from 'react'; |
2 | 2 |
|
3 | 3 | import Gallery from '../../src/react-chayns-gallery/component/Gallery';
|
4 | 4 | import Image from '../../src/react-chayns-gallery/component/Image';
|
5 | 5 | import ImageContainer from '../../src/react-chayns-gallery/component/ImageContainer';
|
6 | 6 |
|
7 |
| -export default function GalleryExample() { |
8 |
| - const images = ['https://tsimg.cloud/127-89061/9d6979d3ac95a053c532f86af9acfb5af9262020.jpg', |
9 |
| - 'https://tsimg.cloud/127-89061/2b83dfa29f2f88bcb35372cbfbefe04a3f899d00.jpg', |
10 |
| - 'https://tsimg.cloud/72975-12914/e087202f5badd652fd015d39df83c35065941fe5.png', |
11 |
| - 'https://tsimg.space/v1/images/6ffbd340-a77b-e811-80d6-0025905a8161.jpg', |
12 |
| - 'https://tsimg.space/v1/images/59a25b31-3997-e811-80d6-0025905a8161.jpg', |
13 |
| - 'https://tsimg.space/v1/images/59a25b31-3997-e811-80d6-0025905a8161.jpg', |
14 |
| - ]; |
| 7 | +export default class GalleryExample extends Component { |
| 8 | + constructor(props) { |
| 9 | + super(props); |
| 10 | + this.state = { |
| 11 | + images: ['https://tsimg.cloud/127-89061/9d6979d3ac95a053c532f86af9acfb5af9262020.jpg', |
| 12 | + 'https://tsimg.cloud/127-89061/2b83dfa29f2f88bcb35372cbfbefe04a3f899d00.jpg', |
| 13 | + 'https://tsimg.cloud/72975-12914/e087202f5badd652fd015d39df83c35065941fe5.png', |
| 14 | + 'https://tsimg.space/v1/images/6ffbd340-a77b-e811-80d6-0025905a8161.jpg', |
| 15 | + 'https://tsimg.space/v1/images/59a25b31-3997-e811-80d6-0025905a8161.jpg', |
| 16 | + 'https://tsimg.space/v1/images/59a25b31-3997-e811-80d6-0025905a8161.jpg', |
| 17 | + ], |
| 18 | + }; |
| 19 | + } |
15 | 20 |
|
16 |
| - return ( |
17 |
| - <div> |
18 |
| - <h3>Gallery-Component</h3> |
19 |
| - <Gallery |
20 |
| - style={{ marginBottom: '30px' }} |
21 |
| - images={images} |
22 |
| - /> |
23 |
| - <Gallery |
24 |
| - style={{ marginBottom: '30px' }} |
25 |
| - images={[images[0], images[1], images[2], images[3], images[4]]} |
26 |
| - /> |
27 |
| - <Gallery |
28 |
| - style={{ marginBottom: '30px' }} |
29 |
| - images={[images[0], images[1], images[2], images[3]]} |
30 |
| - /> |
31 |
| - <Gallery |
32 |
| - style={{ marginBottom: '30px' }} |
33 |
| - images={[images[0], images[1], images[2]]} |
34 |
| - /> |
35 |
| - <Gallery |
36 |
| - style={{ marginBottom: '30px' }} |
37 |
| - images={[images[0], images[1]]} |
38 |
| - /> |
39 |
| - <Gallery |
40 |
| - style={{ marginBottom: '30px' }} |
41 |
| - images={[images[0]]} |
42 |
| - /> |
43 |
| - <h3>Image-Component</h3> |
44 |
| - <Image |
45 |
| - image={images[0]} |
46 |
| - onClick={console.log} |
47 |
| - style={{ width: '100px', height: '100px', marginBottom: '30px' }} |
48 |
| - styleLandscape={{ borderRadius: '10px' }} |
49 |
| - stylePortrait={{ border: '3px solid black' }} |
50 |
| - /> |
51 |
| - <h3>ImageContainer-Component</h3> |
52 |
| - <ImageContainer |
53 |
| - tools={[ |
54 |
| - { icon: 'ts-tobit', onClick: console.log }, |
55 |
| - { icon: 'ts-wrong', onClick: console.log }, |
56 |
| - { icon: 'ts-check', onClick: console.log }, |
57 |
| - ]} |
58 |
| - style={{ marginBottom: '30px' }} |
59 |
| - > |
| 21 | + |
| 22 | + render() { |
| 23 | + const { images } = this.state; |
| 24 | + |
| 25 | + return ( |
| 26 | + <div> |
| 27 | + <h3>Gallery-Component</h3> |
| 28 | + <Gallery |
| 29 | + style={{ marginBottom: '30px' }} |
| 30 | + images={images} |
| 31 | + dragMode |
| 32 | + onDragEnd={(images) => { |
| 33 | + this.setState({ images }); |
| 34 | + }} |
| 35 | + /> |
| 36 | + <Gallery |
| 37 | + style={{ marginBottom: '30px' }} |
| 38 | + images={images} |
| 39 | + /> |
| 40 | + <Gallery |
| 41 | + style={{ marginBottom: '30px' }} |
| 42 | + images={[images[0], images[1], images[2], images[3], images[4]]} |
| 43 | + /> |
| 44 | + <Gallery |
| 45 | + style={{ marginBottom: '30px' }} |
| 46 | + images={[images[0], images[1], images[2], images[3]]} |
| 47 | + /> |
| 48 | + <Gallery |
| 49 | + style={{ marginBottom: '30px' }} |
| 50 | + images={[images[0], images[1], images[2]]} |
| 51 | + /> |
| 52 | + <Gallery |
| 53 | + style={{ marginBottom: '30px' }} |
| 54 | + images={[images[0], images[1]]} |
| 55 | + /> |
| 56 | + <Gallery |
| 57 | + style={{ marginBottom: '30px' }} |
| 58 | + images={[images[0]]} |
| 59 | + /> |
| 60 | + <h3>Image-Component</h3> |
60 | 61 | <Image
|
61 | 62 | image={images[0]}
|
62 | 63 | onClick={console.log}
|
| 64 | + style={{ width: '100px', height: '100px', marginBottom: '30px' }} |
| 65 | + styleLandscape={{ borderRadius: '10px' }} |
| 66 | + stylePortrait={{ border: '3px solid black' }} |
63 | 67 | />
|
64 |
| - </ImageContainer> |
65 |
| - </div> |
66 |
| - ); |
| 68 | + <h3>ImageContainer-Component</h3> |
| 69 | + <ImageContainer |
| 70 | + tools={[ |
| 71 | + { icon: 'ts-tobit', onClick: console.log }, |
| 72 | + { icon: 'ts-wrong', onClick: console.log }, |
| 73 | + { icon: 'ts-check', onClick: console.log }, |
| 74 | + ]} |
| 75 | + style={{ marginBottom: '30px' }} |
| 76 | + > |
| 77 | + <Image |
| 78 | + image={images[0]} |
| 79 | + onClick={console.log} |
| 80 | + /> |
| 81 | + </ImageContainer> |
| 82 | + </div> |
| 83 | + ); |
| 84 | + } |
67 | 85 | }
|
0 commit comments