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 rel="stylesheet" type="text/css" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" />
<div class="container bootstrap snippets bootdey">
<div class="row">
<div class="well">
<h1 class="text-center text-primary">
<b>Vote for your favorite social network</b>
</h1>
<div class="list-group">
<a href="#/" class="list-group-item">
<div class="col-md-3">
<div class="media col-md-12 twitter">
<figure class="pull-left">
<i class="fa fa-twitter"></i>
</figure>
</div>
<div class="media col-md-12">
<button type="button" class="btn btn-default btn-lg btn-block">Vote</button>
<div class="stars text-center text-warning">
<span class="glyphicon glyphicon-star"></span>
<span class="glyphicon glyphicon-star"></span>
<span class="glyphicon glyphicon-star"></span>
<span class="glyphicon glyphicon-star"></span>
<span class="glyphicon glyphicon-star-empty"></span>
</div>
</div>
</div>
<div class="col-md-6 text-center">
<h1 class="vs-title">Vs</h1>
</div>
<div class="col-md-3">
<div class="media col-md-12 facebook-like">
<figure class="pull-left">
<i class="fa fa-facebook"></i>
</figure>
</div>
<div class="media col-md-12">
<button type="button" class="btn btn-default btn-lg btn-block">Vote</button>
<div class="stars text-center text-warning">
<span class="glyphicon glyphicon-star"></span>
<span class="glyphicon glyphicon-star"></span>
<span class="glyphicon glyphicon-star"></span>
<span class="glyphicon glyphicon-star"></span>
<span class="glyphicon glyphicon-star-empty"></span>
</div>
</div>
</div>
</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 :
a.list-group-item {
height: auto;
min-height: 220px;
}
a.list-group-item.active small {
color: #fff;
}
a.list-group-item .vs-title {
font-size: 110px;
}
.fa {
font-size: 100px;
color: #ffffff;
}
.social a {
text-decoration: none;
}
.twitter {
background-color: #00acee;
border-radius: 4px;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}
.facebook-like {
background-color: #3b5998;
border-radius: 4px;
margin-top: -3px;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}
.media {
padding:10px;
}