PortFolio WebPage using React with dark theme
Last Updated :
29 Jul, 2024
A portfolio website is one of the best ways to showcase your skills and information to the world. In this article, you will see how to create a portfolio website with a dark theme.
Project Preview: Let us have a look at how the final output will look like.
Final LookPrerequisites:
Approach to create PortFolio Webpage:
- Integrated GitHub API for fetching repositories dynamically.
- Created a visually appealing Dark Theme for good look.
- Break the project into different sections for Projects, Skills, Experience, and Contact.
- Use CSS for consistent and stylish global styling.
- Used React Hooks for real-time data fetching, ensuring seamless integration.
Steps to Create the Project:
Step 1: Create a react application using the following command.
npx create-react-app portfolio-dark
cd portfolio-dark
Step 2: Install the required dependencies
npm install styled-components
npm install --save @fortawesome/fontawesome-free
npm i @fortawesome/free-brands-svg-icons
Step 3: Create the required file structure as shown in the image.
Project Structure:
Folder StructureThe updated dependencies in package.json file will look like:
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^6.5.1",
"@fortawesome/free-brands-svg-icons": "^6.5.1",
"@fortawesome/react-fontawesome": "^0.2.0",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"styled-components": "^6.1.8",
"web-vitals": "^2.1.4"
}
Example: In the code example we will see the implementation of the portfolio.
CSS
/*App.css */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,400&display=swap');
body {
margin: 0;
font-family: 'Montserrat', sans-serif;
background: linear-gradient(to bottom, #000000, #222222);
}
.portfolio-container {
color: rgb(193, 193, 193);
padding: 20px;
max-width: 800px;
margin: auto;
box-shadow: 0 0 10px #3498db;
border: 2px solid #3498db;
padding: 20px;
border-radius: 20px;
}
header {
display: flex;
align-items: center;
margin-bottom: 20px;
}
.profile-photo {
width: 100px;
height: 100px;
background-image: url('https://media.geeksforgeeks.org/wp-content/uploads/20240208132439/avatar.png');
background-size: cover;
background-position: center;
box-shadow: 0 0 10px #3498db;
border-radius: 50%;
border: 5px solid #3498db;
margin-right: 20px;
}
h1 {
margin: 0;
color: rgb(255, 255, 255);
}
.header-content {
flex: 1;
}
.social-icons {
display: flex;
}
.social-icons a {
color: #fff;
margin-left: 10px;
text-decoration: none;
transition: color 0.3s ease;
}
.social-icons a:hover {
color: #3498db;
}
.pop-effect {
transform: scale(1);
transition: transform 0.3s ease-in-out;
}
.pop-effect:hover {
transform: scale(1.05);
}
.about {
margin-top: 20px;
}
.about h2 {
border-bottom: 2px solid #3498db;
padding-bottom: 5px;
color: rgb(255, 255, 255);
}
.about p {
font-size: 16px;
line-height: 1.6;
}
.projects {
margin-top: 20px;
text-align: left;
}
.projects h2 {
font-size: 24px;
margin-bottom: 10px;
border-bottom: 2px solid #3498db;
padding-bottom: 5px;
color: rgb(255, 255, 255);
}
.project-tile {
background-color: #3498db;
color: #fff;
padding: 15px;
margin-bottom: 20px;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
transition: transform 0.3s ease;
}
.project-tile:hover {
transform: scale(1.05);
}
.project-tile h3 {
font-size: 18px;
margin-bottom: 10px;
}
.project-tile a {
color: #fff;
text-decoration: none;
font-size: 18px;
margin-bottom: 10px;
}
.project-tile p {
font-size: 16px;
}
.skillset {
margin-top: 20px;
}
.skillset h2 {
border-bottom: 2px solid #3498db;
padding-bottom: 5px;
color: rgb(255, 255, 255);
}
.experience h2 {
border-bottom: 2px solid #3498db;
padding-bottom: 5px;
color: rgb(255, 255, 255);
}
.contact h2 {
border-bottom: 2px solid #3498db;
padding-bottom: 5px;
color: rgb(255, 255, 255);
}
JavaScript
//App.js
import React, { useState, useEffect } from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faLinkedin, faGithub,
faPython, faReact } from '@fortawesome/free-brands-svg-icons';
import './App.css'
const App = () => {
const [repositories, setRepositories] = useState([]);
useEffect(() => {
// Fetch GitHub repositories
const fetchRepositories = async () => {
try {
const response = await fetch
('https://api.github.com/users/AbhilashGaurav/repos?per_page=4');
const data = await response.json();
setRepositories(data);
} catch (error) {
console.error('Error fetching GitHub repositories:', error);
}
};
fetchRepositories();
}, []);
return (
<div className="portfolio-container">
<header>
<div className="profile-photo"></div>
<div className="header-content">
<h1>AbhilashGaurav</h1>
<div className="social-icons">
<a href=
"https://www.linkedin.com/in/abhilash-gaurav-8b0a911bb/"
target="_blank" rel="noopener noreferrer">
<FontAwesomeIcon icon={faLinkedin} size="2x" />
</a>
<a href=
"https://github.com/AbhilashGaurav" target="_blank"
rel="noopener noreferrer">
<FontAwesomeIcon icon={faGithub} size="2x" />
</a>
</div>
</div>
</header>
<div className="content">
<section className="about">
<h2>About Me</h2>
<p>
Hello! I'm Abhilash Gaurav, a passionate
web developer with a strong
foundation in React and JavaScript.
I love building engaging and interactive
web applications.Let's create something
amazing together!
</p>
</section>
<section className="projects">
<h2>Projects</h2>
<div className="project-tiles">
{repositories.map(repo => (
<div className="project-tile" key={repo.id}>
<a href={repo.html_url}
target="_blank"
rel="noopener noreferrer">
<b>{repo.name}</b></a>
<p>{repo.description}</p>
</div>
))}
</div>
</section>
<section className="skillset">
<h2>Skillset</h2>
<div className="palettes">
<div>
<FontAwesomeIcon icon={faPython} size="3x" />
<FontAwesomeIcon icon={faReact} size="3x" />
</div>
</div>
</section>
<section className="experience">
<h2>Experience</h2>
Technical Content Writer “python language”
Intern for GeeksForGeeks from
April 2022-October 2022.
</section>
<section className="contact">
<h2>Contact</h2>
<div>
Father’s Name: Mr. Ram Khilawan
</div>
<div>
Mother’s Name: Kamlesh Kumari
</div>
<div>
Date of Birth: 19 Dec 2003
</div>
<div>
Languages Known: English, Hindi
</div>
<div>
Nationality: Indian
</div>
<div>
Hobbies: Playing acoustic Guitar,
football, Listening Smooth Music,
Competitive Coding
</div>
</section>
</div>
</div>
);
};
export default App;
Step 3: To start the application run the following command.
npm start
Output:
Follow the given link to Build and Host your own portfolio website using HTML,CSS and JavaScript.
Similar Reads
Portfolio Website using React
Portfolio Website using React is an online representation of the talent and skills one possesses, along with details of past work and contact information. it is very important for any professional.Table of ContentPreview of Portfolio Website using ReactApproach to Create Portfolio Website using Reac
6 min read
Theming and Dark Mode with React Hooks
React Hooks are a feature introduced in React 16.8 that enable functional components to use state and other React features without writing classes. They provide a way to manage component state, perform side effects, access context, and more within functional components, offering a simpler and more i
3 min read
Webpage using parallax in React
In this example, we will see how we can implement the webpage using parallax in React. Parallax involves the movement of background elements at different speeds as the user scrolls, providing a 3D-like experience. This effect adds a visually appealing depth to the webpage as you scroll, making it mo
2 min read
Create a Portfolio Website Template using Tailwind CSS
In this tutorial, we'll guide you through the process of creating a stunning portfolio website using Tailwind CSS, a powerful CSS framework that makes styling web pages easy and efficient. Preview of Final Output: Let us have a look at how the final output will look like. Personal PortfolioPrerequis
6 min read
Build a Portfolio Website Using React and Bootstrap
Building a portfolio website using React and Bootstrap is an excellent project for showcasing your skills and creating a professional online presence. In this article, we will guide you through the process of building a responsive and visually appealing portfolio website using React for the front en
12 min read
Travel Blog Website using React
Creating a Travel Blog Website using React JS is a better way to learn how to manage state, passing props and render data dynamically. In this article, we are going to learn how to create a Travel Blog Website using React JS. This website will have a list of places with images and description. The d
4 min read
How to add theme to your webpage using Bootswatch in React JS project ?
Bootswatch is an open-source project, that provides several free themes for Bootstrap that a web developer can use. It helps the developer to get proper UI without spending hours and energy on styling different elements. Prerequisites:Node JS or NPMReact JSApproach to add theme using Bootstrap:The H
2 min read
How To Create A Multi-Page Website Using ReactJS?
Multi-page website using ReactJS is the core for building complex web applications that require multiple views or pages. Previously where each page reloads entirely, ReactJS allows you to navigate between different pages without reloading the whole page thanks to libraries like React Router.In this
4 min read
Photography Website using React
In this project, we're going to design an impressive photography website using React. The website will include a beautiful navbar, an introductory section with both an image and text, a photo gallery with a dynamic grid layout, and a modal to showcase selected photos in detail. Additionally, we'll i
5 min read
Environment Protection Website using React
Imagine building a website that champions environmental protection. That's exactly what we're aiming for with this project. We're crafting a space using React where people can learn, share, and engage in all things related to safeguarding our planet.Output Preview: Let us have a look at how the fina
7 min read