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">
<div class="col-md-8">
<ul class="list-listings">
<li class="featured">
<div class="listing-header bg-base">
Featured listing
</div>
<div class="listing-image">
<img src="https://www.bootdey.com/image/300x300/4682B4/000000" class="img-responsive" alt=""/>
</div>
<div class="listing-body">
<h3><a href="#/">Fortitor Posuere & Praesent Metus Ins</a></h3>
<p>
Lorem ipsum dolor sit amet, consectetur adipisg elitm Ut tincidunt purus iaculis ipsum dctum non dtum quam consectetur adipisg elitm Ut tincidunt, Ut tincidunt purus iaculis ipsum dctum non dtum quam consectetur adipisg elitm Ut tincidunt.
</p>
<div class="meta-info">
<ul>
<li><i class="fa fa-calendar"></i> <small>23 July 2014</small></li>
<li><i class="fa fa-user"></i> <small>By <a href="#/">Alex Smith</a></small></li>
<li><i class="fa fa-comment"></i> <small>10 comments</small></li>
<li class="stretch text-right"><a href="#/" class="">Read more</a></li>
</ul>
</div>
</div>
</li>
<li class="">
<div class="listing-image">
<img src="https://www.bootdey.com/image/300x300/FFA07A/000000" class="img-responsive" alt=""/>
</div>
<div class="listing-body">
<h3><a href="#/">Fortitor Posuere & Praesent Metus Ins</a></h3>
<p>
Lorem ipsum dolor sit amet, consectetur adipisg elitm Ut tincidunt purus iaculis ipsum dctum non dtum quam consectetur adipisg elitm Ut tincidunt, Ut tincidunt purus iaculis ipsum dctum non dtum quam consectetur adipisg elitm Ut tincidunt.
</p>
<div class="meta-info">
<ul>
<li><i class="fa fa-calendar"></i> <small>23 July 2014</small></li>
<li><i class="fa fa-user"></i> <small>By <a href="#/">Alex Smith</a></small></li>
<li><i class="fa fa-comment"></i> <small>10 comments</small></li>
<li class="stretch text-right"><a href="#/" class="">Read more</a></li>
</ul>
</div>
</div>
</li>
<li class="">
<div class="listing-image">
<img src="https://www.bootdey.com/image/300x300/20B2AA/000000" class="img-responsive" alt=""/>
</div>
<div class="listing-body">
<h3><a href="#/">Fortitor Posuere & Praesent Metus Ins</a></h3>
<p>
Lorem ipsum dolor sit amet, consectetur adipisg elitm Ut tincidunt purus iaculis ipsum dctum non dtum quam consectetur adipisg elitm Ut tincidunt, Ut tincidunt purus iaculis ipsum dctum non dtum quam consectetur adipisg elitm Ut tincidunt.
</p>
<div class="meta-info">
<ul>
<li><i class="fa fa-calendar"></i> <small>23 July 2014</small></li>
<li><i class="fa fa-user"></i> <small>By <a href="#/">Alex Smith</a></small></li>
<li><i class="fa fa-comment"></i> <small>10 comments</small></li>
<li class="stretch text-right"><a href="#/" class="">Read more</a></li>
</ul>
</div>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
);
}
export default App;
4. Now we need to add below code into our my-awesome-project/src/App.css file :
ul.list-listings {
margin: 0 0 20px 0;
padding: 0;
list-style: none;
}
ul.list-listings>li {
margin-bottom: 30px;
border: 1px solid #e0eded;
border-radius: 2px;
}
ul.list-listings .listing-image {
width: 30%;
display: table-cell;
}
ul.list-listings .listing-image img {
border-bottom-left-radius: 2px;
}
ul.list-listings .listing-body {
padding: 10px 15px;
display: table-cell;
vertical-align: top;
}
ul.list-listings .listing-body h3 {
margin: 0;
padding: 0;
font-size: 18px;
font-weight: 500;
line-height: 25px;
}
ul.list-listings .listing-body p {
margin: 5px 0;
}
ul.list-listings .listing-body .meta-info {
border-top: 1px solid #e0eded;
padding-top: 7px;
}
ul.list-listings .listing-body .meta-info ul {
width: 100%;
display: table;
table-layout: auto;
}
ul.list-listings .listing-body .meta-info ul li {
display: table-cell;
border-right: 1px solid #e0eded;
text-align: center;
}
ul.list-listings .listing-body .meta-info ul li i {
color: #333;
margin-right: 5px;
}
ul.list-listings .listing-body {
padding: 10px 15px;
display: table-cell;
vertical-align: top;
}
.bg-base {
background: #3498db;
color: #fff;
}
ul.list-listings>li.featured {
border-color: #3498db;
}
ul.list-listings>li {
margin-bottom: 30px;
border: 1px solid #e0eded;
border-radius: 2px;
}
ul.list-listings>li:before, ul.list-listings li:after {
content: "";
display: table;
}
ul.list-listings .listing-header {
display: block;
clear: both;
padding: 8px 15px;
font-weight: 600;
text-transform: uppercase;
}