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>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet"/>
<div class="container bootstrap snippets bootdey">
<div class="row">
<h2 class="text-muted">Welcome to our blog</h2>
<hr/>
</div>
<div class="row">
<div class="col-md-8">
<div class="panel blog-container">
<div class="panel-body">
<div class="image-wrapper">
<a class="image-wrapper image-zoom cboxElement" href="#/">
<img src="https://www.bootdey.com/image/700x250/00CED1/000000" alt="Photo of Blog"/>
<div class="image-overlay"></div>
</a>
</div>
<h4>Bootstrap 3.0</h4>
<small class="text-muted">By <a href="#/"><strong> John Doe</strong></a> | Post on Jan 8, 2013 | 58 comments</small>
<p class="m-top-sm m-bottom-sm">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam eros nibh, viverra a dui a, gravida varius velit. Nunc vel tempor nisi. Aenean id pellentesque mi, non placerat mi. Integer luctus accumsan tellus. Vivamus quis elit sit amet nibh lacinia suscipit eu quis purus. Vivamus tristique est non ipsum dapibus lacinia sed nec metus.
</p>
<a href="#/"><i class="fa fa-angle-double-right"></i> Continue reading</a>
<span class="post-like text-muted tooltip-test" data-toggle="tooltip" data-original-title="I like this post!">
<i class="fa fa-heart"></i> <span class="like-count">25</span>
</span>
</div>
</div>
<div class="panel blog-container">
<div class="panel-body">
<div class="image-wrapper">
<a class="image-wrapper image-zoom cboxElement" href="#/">
<img src="https://www.bootdey.com/image/700x250/FF69B4/000000" alt="Photo of Blog"/>
<div class="image-overlay"></div>
</a>
</div>
<h4>Bootstrap 3.0</h4>
<small class="text-muted">By <a href="#/"><strong> John Doe</strong></a> | Post on Jan 8, 2013 | 58 comments</small>
<p class="m-top-sm m-bottom-sm">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam eros nibh, viverra a dui a, gravida varius velit. Nunc vel tempor nisi. Aenean id pellentesque mi, non placerat mi. Integer luctus accumsan tellus. Vivamus quis elit sit amet nibh lacinia suscipit eu quis purus. Vivamus tristique est non ipsum dapibus lacinia sed nec metus.
</p>
<a href="#/"><i class="fa fa-angle-double-right"></i> Continue reading</a>
<span class="post-like text-muted tooltip-test" data-toggle="tooltip" data-original-title="I like this post!">
<i class="fa fa-heart"></i> <span class="like-count">25</span>
</span>
</div>
</div>
</div>
<div class="col-md-4">
<h4 class="headline text-muted">
POPULAR POST
<span class="line"></span>
</h4>
<div class="media popular-post">
<a class="pull-left" href="#/">
<img src="https://www.bootdey.com/image/60x60/9400D3/000000" alt="Popular Post"/>
</a>
<div class="media-body">
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</div>
</div>
<div class="media popular-post">
<a class="pull-left" href="#/">
<img src="https://www.bootdey.com/image/60x60/4B0082/000000" alt="Popular Post"/>
</a>
<div class="media-body">
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</div>
</div>
<div class="media popular-post">
<a class="pull-left" href="#/">
<img src="https://www.bootdey.com/image/60x60/E6E6FA/000000" alt="Popular Post"/>
</a>
<div class="media-body">
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</div>
</div>
<div class="media popular-post">
<a class="pull-left" href="#/">
<img src="https://www.bootdey.com/image/60x60/FFFACD/000000" alt="Popular Post"/>
</a>
<div class="media-body">
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</div>
</div>
<div class="media popular-post">
<a class="pull-left" href="#/">
<img src="https://www.bootdey.com/image/60x60/E0FFFF/000000" alt="Popular Post"/>
</a>
<div class="media-body">
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</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 {
padding-top: 0;
font-size: 12px;
color: #777;
background: #f9f9f9;
font-family: 'Open Sans',sans-serif;
margin-top:20px;
}
.panel {
position: relative;
background: #fff;
}
.image-wrapper {
position: relative;
display: block;
overflow: hidden;
}
.blog-container a:not(.btn) {
color: #999;
transition: all .2s linear;
-webkit-transition: all .2s linear;
-moz-transition: all .2s linear;
-ms-transition: all .2s linear;
-o-transition: all .2s linear;
}
.image-wrapper img {
transition: all .4s ease;
-webkit-transition: all .4s ease;
-moz-transition: all .4s ease;
-ms-transition: all .4s ease;
-o-transition: all .4s ease;
}
.image-wrapper:hover .image-overlay {
opacity: .9;
transition: all .4s ease;
-webkit-transition: all .4s ease;
-moz-transition: all .4s ease;
-ms-transition: all .4s ease;
-o-transition: all .4s ease;
transform: translateX(0%);
-webkit-transform: translateX(0%);
-moz-transform: translateX(0%);
-ms-transform: translateX(0%);
-o-transform: translateX(0%);
}
.image-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
background-color: #3c8dbc;
background-image: -moz-linear-gradient(top,#5fa4cc,#3c8dbc);
background-image: -webkit-gradient(linear,0 0,0 100%,from(#5fa4cc),to(#3c8dbc));
background-image: -webkit-linear-gradient(top,#5fa4cc,#3c8dbc);
background-image: -o-linear-gradient(top,#5fa4cc,#3c8dbc);
background-image: linear-gradient(to bottom,#5fa4cc,#3c8dbc);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#5fa4cc, endColorstr=#3c8dbc, GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
border: 6px solid #296282;
transition: all .4s ease;
-webkit-transition: all .4s ease;
-moz-transition: all .4s ease;
-ms-transition: all .4s ease;
-o-transition: all .4s ease;
}
.post-like {
float: right;
cursor: pointer;
}
.headline {
margin: 20px 0;
padding: 5px 0 10px;
border-bottom: 1px solid #eee;
font-weight: 500;
}
h4, .h4 {
font-size: 18px;
}
.media, .media-body {
overflow: hidden;
zoom: 1;
}