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">
<div class="row">
<div class="col-md-8">
<div class="post-content">
<img src="https://www.bootdey.com/image/400x150/FFB6C1/000000" alt="post-image" class="img-responsive post-image"/>
<div class="post-container">
<img src="https://bootdey.com/img/Content/avatar/avatar6.png" alt="user" class="profile-photo-md pull-left"/>
<div class="post-detail">
<div class="user-info">
<h5><a href="timeline.html" class="profile-link">Alexis Clark</a> <span class="following">following</span></h5>
<p class="text-muted">Published a photo about 3 mins ago</p>
</div>
<div class="reaction">
<a class="btn text-green"><i class="fa fa-thumbs-up"></i> 13</a>
<a class="btn text-red"><i class="fa fa-thumbs-down"></i> 0</a>
</div>
<div class="line-divider"></div>
<div class="post-text">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. <i class="em em-anguished"></i> <i class="em em-anguished"></i> <i class="em em-anguished"></i></p>
</div>
<div class="line-divider"></div>
<div class="post-comment">
<img src="https://bootdey.com/img/Content/avatar/avatar7.png" alt="" class="profile-photo-sm"/>
<p><a href="timeline.html" class="profile-link">Diana </a><i class="em em-laughing"></i> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud </p>
</div>
<div class="post-comment">
<img src="https://bootdey.com/img/Content/avatar/avatar1.png" alt="" class="profile-photo-sm"/>
<p><a href="timeline.html" class="profile-link">John</a> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud </p>
</div>
<div class="post-comment">
<img src="https://bootdey.com/img/Content/avatar/avatar1.png" alt="" class="profile-photo-sm"/>
<input type="text" class="form-control" placeholder="Post a comment"/>
</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;}
/*==================================================
Post Contents CSS
==================================================*/
.post-content{
background: #f8f8f8;
border-radius: 4px;
width: 100%;
border: 1px solid #f1f2f2;
margin-bottom: 20px;
overflow: hidden;
position: relative;
}
.post-content img.post-image, video.post-video, .google-maps{
width: 100%;
height: auto;
}
.post-content .google-maps .map{
height: 300px;
}
.post-content .post-container{
padding: 20px;
}
.post-content .post-container .post-detail{
margin-left: 65px;
position: relative;
}
.post-content .post-container .post-detail .post-text{
line-height: 24px;
margin: 0;
}
.post-content .post-container .post-detail .reaction{
position: absolute;
right: 0;
top: 0;
}
.post-content .post-container .post-detail .post-comment{
display: inline-flex;
margin: 10px auto;
width: 100%;
}
.post-content .post-container .post-detail .post-comment img.profile-photo-sm{
margin-right: 10px;
}
.post-content .post-container .post-detail .post-comment .form-control{
height: 30px;
border: 1px solid #ccc;
box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
margin: 7px 0;
min-width: 0;
}
img.profile-photo-md {
height: 50px;
width: 50px;
border-radius: 50%;
}
img.profile-photo-sm {
height: 40px;
width: 40px;
border-radius: 50%;
}
.text-green {
color: #8dc63f;
}
.text-red {
color: #ef4136;
}
.following {
color: #8dc63f;
font-size: 12px;
margin-left: 20px;
}