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 bootstrap snippets bootdey">
<div class="col-md-10">
<div class="profile-display">
<div class="profile-cover"></div>
<div class="author-info">
<div class="author-info-img" >
</div>
<div class="author-meta">
<h2 class="author-username">
Deyson
</h2>
</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{
background:#ddd;
}
.profile-cover {
background-image: url(https://bootdey.com/img/Content/bg1.jpg);
}
.author-info-img {
background-image: url(https://bootdey.com/img/Content/avatar/avatar7.png);
}
.profile-display {
width: 100%;
position: relative;
box-shadow: 0 1px 12px rgba(0,0,0,0.1);
height: 340px;
background-color: #fff;
}
.profile-cover {
height: 210px;
position: absolute;
top: 0px;
right: 0px;
left: 0px;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
background-position: center center;
}
.author-info {
background-color: #f5f5f5;
padding: 10px;
position: absolute;
top: 40px;
left: 15px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
width: 240px;
}
.author-info .author-info-img {
width: 100%;
height: 220px;
width: 220px;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
background-position: center center;
margin-bottom: 3px;
position: relative;
}
.author-meta {
display: inline-block;
vertical-align: bottom;
}
.author-username {
font-size: 26px;
margin: 5px 0 0 0;
}