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-md-6">
<div class="card widget-user">
<div class="card-body">
<img src="https://bootdey.com/img/Content/avatar/avatar1.png" class="img-fluid d-block rounded-circle avatar-md" alt="user"/>
<div class="wid-u-info">
<h5 class="mt-3 mb-1">Chadengle</h5>
<p class="text-muted mb-0">[email protected]</p>
<div class="user-position">
<span class="text-warning">Admin</span>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<div class="card widget-user">
<div class="card-body">
<img src="https://bootdey.com/img/Content/avatar/avatar6.png" class="img-fluid d-block rounded-circle avatar-md" alt="user"/>
<div class="wid-u-info">
<h5 class="mt-3 mb-1">Michael Zenaty</h5>
<p class="text-muted mb-0">[email protected]</p>
<div class="user-position">
<span class="text-info">Customer</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="card widget-user">
<div class="card-body">
<img src="https://bootdey.com/img/Content/avatar/avatar7.png" class="img-fluid d-block rounded-circle avatar-md" alt="user"/>
<div class="wid-u-info">
<h5 class="mt-3 mb-1">Michael Zenaty</h5>
<p class="text-muted mb-0">[email protected]</p>
<div class="user-position">
<span class="text-danger">User</span>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<div class="card widget-user">
<div class="card-body">
<img src="https://bootdey.com/img/Content/avatar/avatar2.png" class="img-fluid d-block rounded-circle avatar-md" alt="user"/>
<div class="wid-u-info">
<h5 class="mt-3 mb-1">Michael Zenaty</h5>
<p class="text-muted mb-0">[email protected]</p>
<div class="user-position">
<span class="text-success">User</span>
</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;
background:#DCDCDC;
}
.user-position {
position: absolute;
top: 0;
border-left: 1px solid #dee2e6;
bottom: 0;
width: 44px;
font-size: 16px;
text-align: center;
right: 0;
left: auto;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-ms-flex-direction: row;
flex-direction: row
}
.user-position span {
-webkit-transform: rotate(90deg);
transform: rotate(90deg)
}
.avatar-md {
height: 3.5rem;
width: 3.5rem;
}