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.3.0/css/font-awesome.min.css" rel="stylesheet"/>
<div class="container bootstrap snippets bootdey">
<div class="row">
<div class="col-md-4 col-sm-4 col-xs-6">
<div class="relative">
<img src="https://www.bootdey.com/image/400x260/FFB6C1/000000" class="img-responsive" alt=""/>
<a href="#/" class="badge-corner">
<span class="fa fa-thumbs-o-up"></span>
</a>
</div>
</div>
<div class="col-md-4 col-sm-4 col-xs-6">
<div class="relative">
<img src="https://www.bootdey.com/image/400x260/ADD8E6/000000" class="img-responsive" alt=""/>
<a href="#/" class="badge-corner badge-corner-base">
<span class="fa fa-thumbs-o-up"></span>
</a>
</div>
</div>
<div class="col-md-4 col-sm-4 col-xs-6">
<div class="relative">
<img src="https://www.bootdey.com/image/400x260/B0C4DE/000000" class="img-responsive" alt=""/>
<a href="#/" class="badge-corner badge-corner-alt">
<span class="fa fa-thumbs-o-up"></span>
</a>
</div>
</div>
<hr/>
<div class="col-md-4 col-sm-4 col-xs-6">
<div class="relative">
<img src="https://www.bootdey.com/image/400x260/FFB6C1/000000" class="img-responsive" alt=""/>
<a href="#/" class="badge-corner badge-corner-light">
<span class="fa fa-heart"></span>
</a>
</div>
</div>
<div class="col-md-4 col-sm-4 col-xs-6">
<div class="relative">
<img src="https://www.bootdey.com/image/400x260/D3D3D3/000000" class="img-responsive" alt=""/>
<a href="#/" class="badge-corner badge-corner-dark">
<span class="fa fa-heart"></span>
</a>
</div>
</div>
<div class="col-md-4 col-sm-4 col-xs-6">
<div class="relative">
<img src="https://www.bootdey.com/image/400x260/48D1CC/000000" class="img-responsive" alt=""/>
<a href="#/" class="badge-corner badge-corner-orange">
<span class="fa fa-heart"></span>
</a>
</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;
}
.mt-20 {
margin-top: 20px !important;
}
.relative {
position: relative;
}
.badge-corner:empty {
display: inline-block;
}
.badge-corner {
position: absolute;
top: 0;
right: 0;
width: 0;
height: 0;
border-top: 66px solid #888;
border-top-color: rgba(0, 0, 0, 0.3);
border-left: 66px solid transparent;
padding: 0;
background-color: transparent;
border-radius: 0;
}
.badge-corner span {
position: absolute;
top: -52px;
left: -28px;
font-size: 16px;
color: #fff;
}
.badge-corner-base {
border-top-color: #3498db;
}
.badge-corner-alt {
border-top-color: #9cd70e;
}
.badge-corner-light {
border-top-color: #ecf0f1;
}
.badge-corner-light span {
color: #2c3e50;
}
.badge-corner-dark {
border-top-color: #131313;
}
.badge-corner-orange {
border-top-color: #ff8a3c;
}
.relative img{
margin-top:6px;
}