Welcome to my personal portfolio website! This project is designed to showcase my skills, projects, and professional journey. Built using React and Vite, the website features smooth animations powered by GSAP and includes a contact form integrated with EmailJS. The website is deployed using Netlify for easy access and continuous deployment.
Understanding the project structure is crucial for navigating and contributing to the project. Here's a breakdown:
my-portfolio/
β
βββ .env # Environment variables for sensitive information
βββ src/ # Source code for the application
β βββ assets/ # Static assets like images, fonts, and resume
β β βββ resume.pdf # My resume stored as a PDF and images used
β βββ common/ # Reusable components and context
β β βββ projectCard.jsx # Project card component for displaying projects
β β βββ skillList.jsx # Skill list component for displaying skills
β β βββ themeContext.jsx # Context API for managing theme
β β βββ SkillListmodule.css # Skill List styles for components
β βββ sections/ # Different sections of the portfolio
β β βββ hero/ # Hero section
β β βββ navbar/ # Navigation bar
β β βββ footer/ # Footer
β β βββ projects/ # Projects section
β β βββ skills/ # Skills section
β β βββ contact/ # Contact form section with EmailJS integration
β βββ App.jsx # Main application component
βββ package.json # Project dependencies and scripts
-
.env
: Stores sensitive information like EmailJS credentials that shouldn't be exposed in the codebase. This file is ignored by version control to keep your data safe. -
src/assets/
: Contains all static assets like images, fonts, and your resume. The resume is stored as a PDF file for easy access and download. -
src/common/
: This folder houses reusable components and context:projectCard/
: Displays individual projects in the Projects section.skillList/
: Lists out your skills in the Skills section.themeContext.jsx
: Manages theming across the application using React's Context API.module.css
: Contains global styles specific to components in thecommon
folder.
-
src/sections/
: Each section of the portfolio (e.g., Hero, Navbar, Footer) is organized here. Each section has its own folder, containing the JSX and CSS modules:hero/
: The introductory section that captures visitors' attention.navbar/
: The navigation bar that allows users to navigate through different sections.footer/
: Contains contact information and social media links.projects/
: Displays your portfolio projects.skills/
: Showcases your technical skills.contact.jsx
: The contact form that allows users to get in touch with you.
To set up the project locally, follow these steps:
Start by cloning the repository to your local machine:
git clone https://github.com/Slygriyrsk/my-portfolio.git
cd my-portfolio
Next, install the necessary dependencies using npm:
npm install
You'll need to set up environment variables for EmailJS integration. Create a .env
file in the root directory:
VITE_EMAILJS_SERVICE_ID=your_service_id
VITE_EMAILJS_TEMPLATE_ID=your_template_id
VITE_EMAILJS_USER_ID=your_user_id
Make sure to replace your_service_id
, your_template_id
, and your_user_id
with your actual EmailJS credentials.
To see the website in action, start the development server:
npm run dev
Your portfolio should now be running at http://localhost:5173
.
The contact form in this portfolio is powered by EmailJS, allowing visitors to send messages directly to your email without exposing your email address. Here's how it's implemented in contact.jsx
:
import React, { useRef } from 'react';
import emailjs from 'emailjs-com';
const Contact = () => {
const form = useRef();
const sendEmail = (e) => {
e.preventDefault();
emailjs.sendForm(
process.env.VITE_EMAILJS_SERVICE_ID,
process.env.VITE_EMAILJS_TEMPLATE_ID,
form.current,
process.env.VITE_EMAILJS_USER_ID
)
.then((result) => {
console.log(result.text);
alert('Message Sent Successfully!');
}, (error) => {
console.log(error.text);
alert('An error occurred, please try again.');
});
};
return (
<form ref={form} onSubmit={sendEmail}>
<input type="text" name="user_name" placeholder="Your Name" required />
<input type="email" name="user_email" placeholder="Your Email" required />
<textarea name="message" placeholder="Your Message" required />
<button type="submit">Send</button>
</form>
);
};
export default Contact;
- Form Submission: The
sendEmail
function is triggered when the form is submitted. - EmailJS API Call: The form data is sent to EmailJS using the
sendForm
method, with the service ID, template ID, and user ID provided from the.env
file. - Handling Responses: The function handles both success and error scenarios, alerting the user accordingly.
To create a dynamic and engaging user experience, GSAP animations are used in the profile section. Here's an example of how you can animate elements:
import React, { useEffect, useRef } from 'react';
import gsap from 'gsap';
const Profile = () => {
const profileRef = useRef();
useEffect(() => {
gsap.fromTo(profileRef.current, { opacity: 0, y: 50 }, { opacity: 1, y: 0, duration: 1 });
}, []);
return (
<div ref={profileRef}>
<h1>Welcome to My Profile</h1>
<p>I'm a developer with a passion for creating beautiful and functional websites.</p>
</div>
);
};
export default Profile;
useRef
Hook: Used to reference the DOM element you want to animate.useEffect
Hook: Triggers the animation when the component mounts.gsap.fromTo
Method: Animates the element from an initial state (opacity: 0, y: 50) to the final state (opacity: 1, y: 0) over 1 second.
Your resume is stored in the assets
folder and can be easily linked or displayed in your portfolio. Here's how you can import and link it:
import React from 'react';
import myResume from '../assets/resume.pdf';
const Resume = () => {
return (
<a href={myResume} download="My_Resume.pdf">
Download My Resume
</a>
);
};
export default Resume;
This allows visitors to download your resume directly from your portfolio website.
Your portfolio is deployed using Netlify, which provides seamless deployment and continuous integration. Here's how you can deploy your site:
Before deploying, make sure to create a production build of your project:
npm run build
This command generates an optimized and minified version of your site in the dist/
folder.
- Login to Netlify: Go to Netlify and log in with your account.
- Create a New Site: Click on "New site from Git" and connect your GitHub repository.
- Configure Build Settings: Set the build command to
npm run build
and the publish directory todist/
. - Deploy: Click on "Deploy site" and Netlify will handle the rest.
Your site will be live in a few minutes, and you'll be provided with a URL that you can share.
Netlify automatically redeploys your site whenever you push changes to the connected GitHub repository. This ensures that your portfolio is always up to date.
To run the project in a development environment, execute:
npm run dev
This will start the development server, and your application will be available at http://localhost:5173
.
For a production build:
npm run build
npm run serve
This will build the project for production and you can directly open your dist folder in file explorer and import it from there in netifly it will automatically create a domain for your webpage.
Feel free to customize the portfolio to match your personal branding and preferences. You can:
- Change the Color Scheme: Modify the CSS in the
module.css
files within each section or the common components. - Update Content: Simply edit the content in the JSX files under the
sections/
folder to reflect your own experiences, projects, and skills. - Add New Sections: You can easily add new sections by creating new folders under
src/sections/
and integrating them into theApp.jsx
file.
If you'd like to contribute to this project, follow these steps:
- Fork the Repository: Click the "Fork" button on the repository's GitHub page.
- Clone the Fork: Clone your forked repository to your local machine.
- Create a New Branch: Create a new branch for your feature or bug fix.
- Make Your Changes: Implement your changes and commit them with a descriptive message.
- Push to GitHub: Push your changes to your fork on GitHub.
- Submit a Pull Request: Open a pull request on the original repository.
I welcome all contributions, from fixing typos to adding new features!
This project is licensed under the MIT License, meaning you can freely use, modify, and distribute the code as long as you include the original license and attribution.
- React and Vite: For providing a solid foundation to build upon.
- EmailJS: For making email integration straightforward and accessible.
- GSAP: For the powerful animations that make the site feel alive.
- Netlify: For simplifying the deployment process and enabling continuous integration.
Thank you for visiting my portfolio! I hope it serves as a comprehensive showcase of my skills and projects. Feel free to explore and reach out to me via the contact form!