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.7.0/css/font-awesome.min.css" rel="stylesheet" />
<div class="container">
<div class="row row-cols-1 row-cols-md-2 row-cols-xl-4">
<div class="col">
<div class="card radius-10 border-start border-0 border-3 border-info">
<div class="card-body">
<div class="d-flex align-items-center">
<div>
<p class="mb-0 text-secondary">Total Orders</p>
<h4 class="my-1 text-info">4805</h4>
<p class="mb-0 font-13">+2.5% from last week</p>
</div>
<div class="widgets-icons-2 rounded-circle bg-gradient-scooter text-white ms-auto"><i class="fa fa-shopping-cart"></i>
</div>
</div>
</div>
</div>
</div>
<div class="col">
<div class="card radius-10 border-start border-0 border-3 border-danger">
<div class="card-body">
<div class="d-flex align-items-center">
<div>
<p class="mb-0 text-secondary">Total Revenue</p>
<h4 class="my-1 text-danger">$84,245</h4>
<p class="mb-0 font-13">+5.4% from last week</p>
</div>
<div class="widgets-icons-2 rounded-circle bg-gradient-bloody text-white ms-auto"><i class="fa fa-dollar"></i>
</div>
</div>
</div>
</div>
</div>
<div class="col">
<div class="card radius-10 border-start border-0 border-3 border-success">
<div class="card-body">
<div class="d-flex align-items-center">
<div>
<p class="mb-0 text-secondary">Bounce Rate</p>
<h4 class="my-1 text-success">34.6%</h4>
<p class="mb-0 font-13">-4.5% from last week</p>
</div>
<div class="widgets-icons-2 rounded-circle bg-gradient-ohhappiness text-white ms-auto"><i class="fa fa-bar-chart"></i>
</div>
</div>
</div>
</div>
</div>
<div class="col">
<div class="card radius-10 border-start border-0 border-3 border-warning">
<div class="card-body">
<div class="d-flex align-items-center">
<div>
<p class="mb-0 text-secondary">Total Customers</p>
<h4 class="my-1 text-warning">8.4K</h4>
<p class="mb-0 font-13">+8.4% from last week</p>
</div>
<div class="widgets-icons-2 rounded-circle bg-gradient-blooker text-white ms-auto"><i class="fa fa-users"></i>
</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-color: #f7f7ff;
}
.radius-10 {
border-radius: 10px !important;
}
.border-info {
border-left: 5px solid #0dcaf0 !important;
}
.border-danger {
border-left: 5px solid #fd3550 !important;
}
.border-success {
border-left: 5px solid #15ca20 !important;
}
.border-warning {
border-left: 5px solid #ffc107 !important;
}
.card {
position: relative;
display: flex;
flex-direction: column;
min-width: 0;
word-wrap: break-word;
background-color: #fff;
background-clip: border-box;
border: 0px solid rgba(0, 0, 0, 0);
border-radius: .25rem;
margin-bottom: 1.5rem;
box-shadow: 0 2px 6px 0 rgb(218 218 253 / 65%), 0 2px 6px 0 rgb(206 206 238 / 54%);
}
.bg-gradient-scooter {
background: #17ead9;
background: -webkit-linear-gradient(
45deg
, #17ead9, #6078ea)!important;
background: linear-gradient(
45deg
, #17ead9, #6078ea)!important;
}
.widgets-icons-2 {
width: 56px;
height: 56px;
display: flex;
align-items: center;
justify-content: center;
background-color: #ededed;
font-size: 27px;
border-radius: 10px;
}
.rounded-circle {
border-radius: 50%!important;
}
.text-white {
color: #fff!important;
}
.ms-auto {
margin-left: auto!important;
}
.bg-gradient-bloody {
background: #f54ea2;
background: -webkit-linear-gradient(
45deg
, #f54ea2, #ff7676)!important;
background: linear-gradient(
45deg
, #f54ea2, #ff7676)!important;
}
.bg-gradient-ohhappiness {
background: #00b09b;
background: -webkit-linear-gradient(
45deg
, #00b09b, #96c93d)!important;
background: linear-gradient(
45deg
, #00b09b, #96c93d)!important;
}
.bg-gradient-blooker {
background: #ffdf40;
background: -webkit-linear-gradient(
45deg
, #ffdf40, #ff8359)!important;
background: linear-gradient(
45deg
, #ffdf40, #ff8359)!important;
}