项目作者: ibraAbuKaff

项目描述 :
React js Flexible Image Grid View
高级语言: JavaScript
项目地址: git://github.com/ibraAbuKaff/react-flexi-image-grid.git
创建时间: 2018-04-30T14:38:41Z
项目社区:https://github.com/ibraAbuKaff/react-flexi-image-grid

开源协议:MIT License

下载


react-flexi-image-grid

React js Flexible Image Grid View

How to install ?



  1. yarn add react-flexi-image-grid








Examples:

4 Columns:

4 columns pics

2 Columns:

2 columns pics

How to use it ?

  1. import React, {Component} from "react";
  2. import {FlexiImageGrid} from "react-flexi-image-grid";
  3. class App extends Component {
  4. onClickHandler = (e) => {
  5. console.log(e.target.id);
  6. console.log(e.target.className);
  7. console.log(e.target.src);
  8. };
  9. render() {
  10. return (
  11. <div className="App">
  12. <FlexiImageGrid
  13. images={[
  14. {
  15. src: "https://images.wallpaperscraft.com/image/girl_back_dress_120695_1920x1080.jpg",
  16. className: "img1",
  17. id: "idImg1",
  18. height: "200px",
  19. alt: "here 1",
  20. },
  21. {
  22. src: "https://images.wallpaperscraft.com/image/auto_sports_car_red_120693_1920x1080.jpg",
  23. className: "img2",
  24. height: "",
  25. },
  26. {
  27. src: "https://images.wallpaperscraft.com/image/auto_side_view_sports_car_red_118923_1920x1080.jpg",
  28. className: "img4"
  29. },
  30. {
  31. src: "https://images.wallpaperscraft.com/image/auto_side_view_sports_car_117332_1920x1080.jpg",
  32. className: "img5"
  33. }
  34. ,
  35. {
  36. src: "https://i.pinimg.com/originals/6f/55/26/6f5526229f0b3f18e1cf64bd4eb5a62f.jpg",
  37. className: "img6"
  38. }
  39. ]}
  40. numberOfColumns={4}
  41. onClick={this.onClickHandler}
  42. ></FlexiImageGrid>
  43. </div>
  44. );
  45. }
  46. }
  47. export default App;

Expected Props:

1- images , it’s an array of objects , each object can have the following structure:

  1. {
  2. src: "https://www.w3schools.com/w3images/wedding.jpg",
  3. className: "img1",
  4. id: "idImg1",
  5. height: "200px",
  6. alt: "here 1",
  7. }

2- numberOfColumns it can be 1, 2 ,or 4