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="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-12">
<div class="row portfolio-grid">
<div class="col-xl-3 col-lg-3 col-md-3 col-sm-6 col-12">
<figure class="effect-text-in">
<img src="https://bootdey.com/img/Content/avatar/avatar1.png" alt="image"/>
<figcaption>
<h4>Photography</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit</p>
</figcaption>
</figure>
</div>
<div class="col-xl-3 col-lg-3 col-md-3 col-sm-6 col-12">
<figure class="effect-text-in">
<img src="https://bootdey.com/img/Content/avatar/avatar2.png" alt="image"/>
<figcaption>
<h4>Lifestyle</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit</p>
</figcaption>
</figure>
</div>
<div class="col-xl-3 col-lg-3 col-md-3 col-sm-6 col-12">
<figure class="effect-text-in">
<img src="https://bootdey.com/img/Content/avatar/avatar3.png" alt="image"/>
<figcaption>
<h4>Tech Geeks</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit</p>
</figcaption>
</figure>
</div>
<div class="col-xl-3 col-lg-3 col-md-3 col-sm-6 col-12">
<figure class="effect-text-in">
<img src="https://bootdey.com/img/Content/avatar/avatar4.png" alt="image"/>
<figcaption>
<h4>Explore World</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit</p>
</figcaption>
</figure>
</div>
<div class="col-xl-3 col-lg-3 col-md-3 col-sm-6 col-12">
<figure class="effect-text-in">
<img src="https://bootdey.com/img/Content/avatar/avatar6.png" alt="image"/>
<figcaption>
<h4>Travel</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit</p>
</figcaption>
</figure>
</div>
<div class="col-xl-3 col-lg-3 col-md-3 col-sm-6 col-12">
<figure class="effect-text-in">
<img src="https://bootdey.com/img/Content/avatar/avatar7.png" alt="image"/>
<figcaption>
<h4>Colors</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit</p>
</figcaption>
</figure>
</div>
<div class="col-xl-3 col-lg-3 col-md-3 col-sm-6 col-12">
<figure class="effect-text-in">
<img src="https://bootdey.com/img/Content/avatar/avatar1.png" alt="image"/>
<figcaption>
<h4>Through Nature</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit</p>
</figcaption>
</figure>
</div>
<div class="col-xl-3 col-lg-3 col-md-3 col-sm-6 col-12">
<figure class="effect-text-in">
<img src="https://bootdey.com/img/Content/avatar/avatar2.png" alt="image"/>
<figcaption>
<h4>World</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit</p>
</figcaption>
</figure>
</div>
<div class="col-xl-3 col-lg-3 col-md-3 col-sm-6 col-12">
<figure class="effect-text-in">
<img src="https://bootdey.com/img/Content/avatar/avatar3.png" alt="image"/>
<figcaption>
<h4>Cultures</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit</p>
</figcaption>
</figure>
</div>
<div class="col-xl-3 col-lg-3 col-md-3 col-sm-6 col-12">
<figure class="effect-text-in">
<img src="https://bootdey.com/img/Content/avatar/avatar4.png" alt="image"/>
<figcaption>
<h4>Habits</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit</p>
</figcaption>
</figure>
</div>
<div class="col-xl-3 col-lg-3 col-md-3 col-sm-6 col-12">
<figure class="effect-text-in">
<img src="https://bootdey.com/img/Content/avatar/avatar1.png" alt="image"/>
<figcaption>
<h4>Being yourself</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit</p>
</figcaption>
</figure>
</div>
<div class="col-xl-3 col-lg-3 col-md-3 col-sm-6 col-12">
<figure class="effect-text-in">
<img src="https://bootdey.com/img/Content/avatar/avatar6.png" alt="image"/>
<figcaption>
<h4>Nature</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit</p>
</figcaption>
</figure>
</div>
<div class="col-xl-3 col-lg-3 col-md-3 col-sm-6 col-12">
<figure class="effect-text-in">
<img src="https://bootdey.com/img/Content/avatar/avatar7.png" alt="image"/>
<figcaption>
<h4>Routines</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit</p>
</figcaption>
</figure>
</div>
<div class="col-xl-3 col-lg-3 col-md-3 col-sm-6 col-12">
<figure class="effect-text-in">
<img src="https://bootdey.com/img/Content/avatar/avatar1.png" alt="image"/>
<figcaption>
<h4>Life</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit</p>
</figcaption>
</figure>
</div>
<div class="col-xl-3 col-lg-3 col-md-3 col-sm-6 col-12">
<figure class="effect-text-in">
<img src="https://bootdey.com/img/Content/avatar/avatar2.png" alt="image"/>
<figcaption>
<h4>Vision</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit</p>
</figcaption>
</figure>
</div>
</div>
</div>
</div>
</div>
</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;}
/* Portfolio */
.portfolio-grid figure {
position: relative;
float: left;
overflow: hidden;
width: 100%;
background: #464dee;
text-align: center;
cursor: pointer;
}
.portfolio-grid figure img {
position: relative;
display: block;
min-height: 100%;
max-width: 100%;
width: 100%;
opacity: 0.8;
}
.portfolio-grid figure figcaption {
padding: 2em;
color: #ffffff;
text-transform: uppercase;
font-size: 1.25em;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.portfolio-grid figure figcaption:after, .portfolio-grid figure figcaption:before {
pointer-events: none;
}
.portfolio-grid figure.effect-text-in {
border-radius: 0.25rem;
}
.portfolio-grid figure.effect-text-in h4,
.portfolio-grid figure.effect-text-in img {
-webkit-transition: -webkit-transform 0.35s;
transition: transform 0.35s;
}
.portfolio-grid figure.effect-text-in img {
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
}
.portfolio-grid figure.effect-text-in h4,
.portfolio-grid figure.effect-text-in p {
position: absolute;
bottom: 10px;
left: 0;
padding: 10px;
margin-bottom: 0;
width: 100%;
}
.portfolio-grid figure.effect-text-in p {
text-transform: none;
opacity: 0;
-webkit-transition: opacity 0.35s, -webkit-transform 0.35s;
transition: opacity 0.35s, transform 0.35s;
-webkit-transform: translate3d(0, 50px, 0);
transform: translate3d(0, 50px, 0);
}
.portfolio-grid figure.effect-text-in:hover img {
-webkit-transform: translate3d(0, -80px, 0);
transform: translate3d(0, -80px, 0);
}
.portfolio-grid figure.effect-text-in:hover h4 {
-webkit-transform: translate3d(0, -100px, 0);
transform: translate3d(0, -100px, 0);
}
.portfolio-grid figure.effect-text-in:hover p {
opacity: 1;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}