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">
<div class="col-sm-6 col-md-6 mb-3">
<div class="card">
<div class="card-body">
<div class="d-flex align-items-center position-relative pb-3">
<div class="flex-shrink-0">
<img class="img-md rounded-circle" src="https://bootdey.com/img/Content/avatar/avatar1.png" alt="Profile Picture" loading="lazy"/>
</div>
<div class="flex-grow-1 ms-3">
<a href="#/" class="h5 stretched-link btn-link">Stephen Tran</a>
<p class="text-muted m-0">Marketing manager</p>
</div>
</div>
<p>Lorem ipsum dolor sit amet consec tetur adipisicing elit.</p>
<div class="mt-3 pt-2 text-center border-top">
<div class="d-flex justify-content-center gap-3">
<a href="#/" class="btn btn-sm btn-info btn-outline-light btn-lg">
<i class="fa fa-phone" aria-hidden="true"></i> Call
</a>
<a href="#/" class="btn btn-sm btn-info btn-outline-light btn-lg">
<i class="fa fa-envelope" aria-hidden="true"></i> Email
</a>
<a href="#/" class="btn btn-sm btn-info btn-outline-light btn-lg">
<i class="fa fa-pencil" aria-hidden="true"></i>Edit
</a>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-6 mb-3">
<div class="card">
<div class="card-body">
<div class="d-flex align-items-center position-relative pb-3">
<div class="flex-shrink-0">
<img class="img-md rounded-circle" src="https://bootdey.com/img/Content/avatar/avatar2.png" alt="Profile Picture" loading="lazy"/>
</div>
<div class="flex-grow-1 ms-3">
<a href="#/" class="h5 stretched-link btn-link">Stephen Tran</a>
<p class="text-muted m-0">Marketing manager</p>
</div>
</div>
<p>Lorem ipsum dolor sit amet consec tetur adipisicing elit.</p>
<div class="mt-3 pt-2 text-center border-top">
<div class="d-flex justify-content-center gap-3">
<a href="#/" class="btn btn-sm btn-info btn-outline-light btn-lg">
<i class="fa fa-phone" aria-hidden="true"></i> Call
</a>
<a href="#/" class="btn btn-sm btn-info btn-outline-light btn-lg">
<i class="fa fa-envelope" aria-hidden="true"></i> Email
</a>
<a href="#/" class="btn btn-sm btn-info btn-outline-light btn-lg">
<i class="fa fa-pencil" aria-hidden="true"></i>Edit
</a>
</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:#eee;
}
.card {
box-shadow: 0 20px 27px 0 rgb(0 0 0 / 5%);
}
.img-md {
width: 4rem;
height: 4rem;
}
.btn-link {
transition-property: color,background-color;
box-shadow: none;
border-radius: 0;
text-decoration: none!important;
}