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 bootstrap snippets bootdeys">
<div class="col-md-8 col-sm-12">
<div class="comment-wrapper">
<div class="panel panel-info">
<div class="panel-heading">
Comment panel
</div>
<div class="panel-body">
<textarea class="form-control" placeholder="write a comment..." rows="3"></textarea>
<br/>
<button type="button" class="btn btn-info pull-right">Post</button>
<div class="clearfix"></div>
<hr/>
<ul class="media-list">
<li class="media">
<a href="#/" class="pull-left">
<img src="https://bootdey.com/img/Content/user_1.jpg" alt="" class="img-circle"/>
</a>
<div class="media-body">
<span class="text-muted pull-right">
<small class="text-muted">30 min ago</small>
</span>
<strong class="text-success">@MartinoMont</strong>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Lorem ipsum dolor sit amet, <a href="#/">#consecteturadipiscing </a>.
</p>
</div>
</li>
<li class="media">
<a href="#/" class="pull-left">
<img src="https://bootdey.com/img/Content/user_2.jpg" alt="" class="img-circle"/>
</a>
<div class="media-body">
<span class="text-muted pull-right">
<small class="text-muted">30 min ago</small>
</span>
<strong class="text-success">@LaurenceCorreil</strong>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Lorem ipsum dolor <a href="#/">#ipsumdolor </a>adipiscing elit.
</p>
</div>
</li>
<li class="media">
<a href="#/" class="pull-left">
<img src="https://bootdey.com/img/Content/user_3.jpg" alt="" class="img-circle"/>
</a>
<div class="media-body">
<span class="text-muted pull-right">
<small class="text-muted">30 min ago</small>
</span>
<strong class="text-success">@JohnNida</strong>
<p>
Lorem ipsum dolor <a href="#/">#sitamet</a> sit amet, consectetur adipiscing elit.
</p>
</div>
</li>
</ul>
</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;}
.comment-wrapper .panel-body {
max-height:650px;
overflow:auto;
}
.comment-wrapper .media-list .media img {
width:64px;
height:64px;
border:2px solid #e5e7e8;
}
.comment-wrapper .media-list .media {
border-bottom:1px dashed #efefef;
margin-bottom:25px;
}