1. First, we need fresh reactjs setup, and for that, we need to run below commands into out terminal, and also we should have latest node version installed on our system:
npx create-react-app my-awesome-project
cd my-awesome-project
npm start
2. Now we need to run below commands into our project terminal to get bootstrap and related modules into our reactjs application:
npm install [email protected] --save
npm start //For start project again
3. Finally for the main output, we need to add below code into our my-awesome-project/src/App.js file or if you have fresh setup then you can replace my-awesome-project/src/App.js file code with below code:
import React from 'react';
import './App.css';
import 'bootstrap/dist/css/bootstrap.min.css';
function App() {
return (
<div>
<div class="container">
<div class="col-md-12">
<div class="popup-gallery">
<a href="#/" title="Photo 1"><img src="https://www.bootdey.com/image/128x100/FF4500" alt=""/></a>
<a href="#/" title="Photo 1"><img src="https://www.bootdey.com/image/128x100/FFA500" alt=""/></a>
<a href="#/" title="Photo 1"><img src="https://www.bootdey.com/image/128x100/DA70D6" alt=""/></a>
<a href="#/" title="Photo 1"><img src="https://www.bootdey.com/image/128x100/663399" alt=""/></a>
<a href="#/" title="Photo 1"><img src="https://www.bootdey.com/image/128x100/4169E1" alt=""/></a>
<a href="#/" title="Photo 1"><img src="https://www.bootdey.com/image/128x100/6A5ACD" alt=""/></a>
<a href="#/" title="Photo 1"><img src="https://www.bootdey.com/image/128x100/87CEEB" alt=""/></a>
<a href="#/" title="Photo 1"><img src="https://www.bootdey.com/image/128x100/4682B4" alt=""/></a>
<a href="#/" title="Photo 1"><img src="https://www.bootdey.com/image/128x100/008080" alt=""/></a>
<a href="#/" title="Photo 1"><img src="https://www.bootdey.com/image/128x100/40E0D0" alt=""/></a>
<a href="#/" title="Photo 1"><img src="https://www.bootdey.com/image/128x100/FA8072" alt=""/></a>
<a href="#/" title="Photo 1"><img src="https://www.bootdey.com/image/128x100/663399" alt=""/></a>
<a href="#/" title="Photo 1"><img src="https://www.bootdey.com/image/128x100/DDA0DD" alt=""/></a>
<a href="#/" title="Photo 1"><img src="https://www.bootdey.com/image/128x100/98FB98" alt=""/></a>
<a href="#/" title="Photo 1"><img src="https://www.bootdey.com/image/128x100/AFEEEE" alt=""/></a>
<a href="#/" title="Photo 1"><img src="https://www.bootdey.com/image/128x100/FFDAB9" alt=""/></a>
<a href="#/" title="Photo 1"><img src="https://www.bootdey.com/image/128x100/EEE8AA" alt=""/></a>
<a href="#/" title="Photo 1"><img src="https://www.bootdey.com/image/128x100/000080" alt=""/></a>
<a href="#/" title="Photo 1"><img src="https://www.bootdey.com/image/128x100/DDA0DD" alt=""/></a>
<a href="#/" title="Photo 1"><img src="https://www.bootdey.com/image/128x100/FF4500" alt=""/></a>
<a href="#/" title="Photo 1"><img src="https://www.bootdey.com/image/128x100/6A5ACD" alt=""/></a>
<a href="#/" title="Photo 1"><img src="https://www.bootdey.com/image/128x100/87CEEB" alt=""/></a>
<a href="#/" title="Photo 1"><img src="https://www.bootdey.com/image/128x100/FA8072" alt=""/></a>
<a href="#/" title="Photo 1"><img src="https://www.bootdey.com/image/128x100/663399" alt=""/></a>
</div>
</div>
</div>
<div class="modal fade" id="modalShow" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body text-center">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
);
}
export default App;
4. Now we need to add below code into our my-awesome-project/src/App.css file :
body{margin-top:20px;}
.popup-gallery a img {
margin: 2px 0;
width:128px;
height:100px;
display: inline-block;
line-height: 1.42857143;
background-color: #fff;
-webkit-transition: border .2s ease-in-out;
-o-transition: border .2s ease-in-out;
transition: border .2s ease-in-out;
}
.popup-gallery a img:hover {
opacity: 0.6;
filter: alpha(opacity=60); /* For IE8 and earlier */
}