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-12 col-sm-12 col-sx-12">
<div class="current-profile">
<div class="user-bg" style={{/*background: url(https://bootdey.com/img/Content/bg1.jpg) no-repeat;*/}}></div>
<div class="user-pic" style={{/*background: url(https://bootdey.com/img/Content/user_3.jpg) no-repeat*/}}> </div>
<div class="user-details">
<h4 class="user-name">Camilo<i>!</i></h4>
<h5 class="description">Hi, I'm UI Designer from Canada. I like to design web and mobile applications that look good and work well.</h5>
</div>
<div class="social-list">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<div class="row">
<div class="col-md-3 col-sm-3 col-xs-3 center-align-text">
<h3>2359</h3>
<small>Posts</small>
</div>
<div class="col-md-3 col-sm-3 col-xs-3 center-align-text">
<h3>1278</h3>
<small>Followers</small>
</div>
<div class="col-md-3 col-sm-3 col-xs-3 center-align-text">
<h3>7315</h3>
<small>Likes</small>
</div>
<div class="col-md-3 col-sm-3 col-xs-3 center-align-text">
<h3>189</h3>
<small>Contacts</small>
</div>
</div>
</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;
}
.current-profile .user-bg {
background-position: bottom center;
height: 280px;
position: relative;
}
.current-profile .user-pic {
background-position: center center !important;
background-size:cover !important;
height: 120px;
width: 120px;
position: absolute;
left: 0;
right: 0;
margin: 0px auto;
top: 20px;
border: 5px solid #fff;
-webkit-border-radius: 100px;
-moz-border-radius: 100px;
border-radius: 100px;
}
.current-profile .user-details {
position: absolute;
top: 150px;
text-align: center;
margin: auto;
left: 10px;
right: 10px;
}
.current-profile h4.user-name {
color: white;
text-align: center;
margin: 0;
padding: 0;
}
.current-profile h5.description {
color: white;
margin: 10px 0 0 0;
text-align: center;
font-weight: 100;
line-height: 21px;
}
.current-profile .social-list {
margin: 0;
position: absolute;
bottom: 0px;
left: 10px;
right: 10px;
background-color: rgba(0, 0, 0, 0.3);
padding: 6px 0;
border-top: 1px solid rgba(0, 0, 0, 0.2);
}
.current-profile .social-list h3 {
color: white;
padding: 0;
margin: 7px 0 0 0;
}
.current-profile .social-list small {
color: white;
}
@media (max-width: 767px) {
.current-profile .user-bg {
height: 260px;
}
.current-profile .user-pic {
height: 72px;
width: 72px;
}
.current-profile .user-details {
position: absolute;
top: 100px;
}
.current-profile .social-list {
position: absolute;
bottom: 0;
}
.current-profile .social-list h3 {
font-size: 16px;
}
}