Skip to content

Commit

Permalink
Merge pull request #5 from ksentak/feature/typescript
Browse files Browse the repository at this point in the history
Feature/typescript
  • Loading branch information
ksentak authored Jun 3, 2021
2 parents 1624e86 + 293aa0f commit 0c1227a
Show file tree
Hide file tree
Showing 26 changed files with 12,283 additions and 17,093 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Keaton React Portfolio

- My personal portfolio website
- Built with React/Gatsby
- My personal portfolio website
- Built with React/Gatsby/Typescript

---

Expand Down
1 change: 1 addition & 0 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = {
},
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
`gatsby-plugin-image`,
{
resolve: `gatsby-plugin-manifest`,
options: {
Expand Down
28,939 changes: 12,036 additions & 16,903 deletions package-lock.json

Large diffs are not rendered by default.

42 changes: 23 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,38 @@
{
"name": "keaton-gatsby-portfolio",
"private": true,
"version": "3.3.0",
"version": "4.0.1",
"homepage": "https://keatonsentak.com/",
"author": "Keaton Sentak",
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.34",
"@fortawesome/free-brands-svg-icons": "^5.15.2",
"@fortawesome/free-solid-svg-icons": "^5.15.2",
"@fortawesome/fontawesome-svg-core": "^1.2.35",
"@fortawesome/free-brands-svg-icons": "^5.15.3",
"@fortawesome/free-solid-svg-icons": "^5.15.3",
"@fortawesome/react-fontawesome": "^0.1.14",
"bootstrap": "^4.5.3",
"@types/react": "^17.0.9",
"@types/react-dom": "^17.0.6",
"bootstrap": "^5.0.1",
"emailjs-com": "^2.6.4",
"gatsby": "^2.26.1",
"gatsby-image": "^2.5.0",
"gatsby-plugin-manifest": "^2.6.1",
"gatsby-plugin-offline": "^3.4.0",
"gatsby-plugin-react-helmet": "^3.4.0",
"gatsby-plugin-sharp": "^2.8.0",
"gatsby-source-filesystem": "^2.5.0",
"gatsby-transformer-sharp": "^2.6.0",
"gatsby": "^3.4.1",
"gatsby-plugin-gatsby-cloud": "^2.4.1",
"gatsby-plugin-image": "^1.4.0",
"gatsby-plugin-manifest": "^3.4.0",
"gatsby-plugin-offline": "^4.4.0",
"gatsby-plugin-react-helmet": "^4.4.0",
"gatsby-plugin-sharp": "^3.4.1",
"gatsby-source-filesystem": "^3.4.0",
"gatsby-transformer-sharp": "^3.4.0",
"prop-types": "^15.7.2",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-helmet": "^6.1.0",
"react-hook-form": "^6.14.1",
"react-toastify": "^6.2.0",
"react-tsparticles": "^1.18.11",
"reactstrap": "^8.8.1"
"react-hook-form": "^7.7.1",
"react-toastify": "^7.0.4",
"react-tsparticles": "^1.27.0",
"reactstrap": "^8.9.0"
},
"devDependencies": {
"@types/react-helmet": "^6.1.1",
"prettier": "2.2.1"
},
"keywords": [
Expand Down
15 changes: 5 additions & 10 deletions src/components/banner.js → src/components/banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ import React from 'react';
import Particles from 'react-tsparticles';
import Socials from './socials';

const Banner = () => {
const Banner: React.FC = () => {
const config = {
fpsLimit: 60,
particles: {
number: {
value: 160,
value: 100,
density: {
enable: false
}
},
color: {
value: '#ffffff'
value: '#90caf9'
},
shape: {
type: 'circle',
Expand All @@ -26,7 +26,7 @@ const Banner = () => {
}
},
opacity: {
value: 0.1
value: 0.4
},
size: {
value: 5,
Expand All @@ -36,15 +36,10 @@ const Banner = () => {
size_min: 0.3
}
},
line_linked: {
enabled: false
},
move: {
enable: true,
random: true,
speed: 1,
direction: 'top',
out_mode: 'out'
speed: 1
}
}
};
Expand Down
57 changes: 37 additions & 20 deletions src/components/contactform.js → src/components/contactForm.tsx
Original file line number Diff line number Diff line change
@@ -1,44 +1,60 @@
import React from 'react';
import React, { useState } from 'react';
import { useForm } from 'react-hook-form';
import emailjs from 'emailjs-com';
import { ToastContainer, toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.min.css';

const ContactForm = () => {
const { register, errors, handleSubmit, reset } = useForm();
interface Data {
name: string;
email: string;
subject: string;
message: string;
}

const toastifySuccess = () => {
const ContactForm: React.FC = () => {
const [disabled, setDisabled] = useState(false);
const {
register,
handleSubmit,
reset,
formState: { errors }
} = useForm();

const toastifySuccess = (): void => {
toast('Form sent!', {
position: 'bottom-right',
autoClose: 5000,
hideProgressBar: true,
closeOnClick: true,
pauseOnHover: true,
draggable: false,
className: 'submit-feedback success',
toastId: 'notifyToast'
className: 'submit-feedback'
});
};

const onSubmit = async (data) => {
const onSubmit = async (data: Data) => {
// Send form email
try {
const templateParams = {
setDisabled(true);
const templateParams: Data = {
name: data.name,
email: data.email,
subject: data.subject,
message: data.message
};

console.log(templateParams);

await emailjs.send(
process.env.GATSBY_SERVICE_ID,
process.env.GATSBY_TEMPLATE_ID,
process.env.GATSBY_SERVICE_ID || '',
process.env.GATSBY_TEMPLATE_ID || '',
templateParams,
process.env.GATSBY_USER_ID
);

reset();
toastifySuccess();
setDisabled(false);
} catch (e) {
console.log(e);
}
Expand All @@ -50,14 +66,18 @@ const ContactForm = () => {
<div className='row'>
<div className='col-12 text-center'>
<div className='contactForm'>
<form id='contact-form' onSubmit={handleSubmit(onSubmit)} noValidate>
<form
id='contact-form'
onSubmit={handleSubmit(onSubmit)}
method='POST'
noValidate={true}
>
{/* Row 1 of form */}
<div className='row formRow'>
<div className='col-6'>
<input
type='text'
name='name'
ref={register({
{...register('name', {
required: { value: true, message: 'Please enter your name' },
maxLength: {
value: 30,
Expand All @@ -72,8 +92,7 @@ const ContactForm = () => {
<div className='col-6'>
<input
type='email'
name='email'
ref={register({
{...register('email', {
required: true,
pattern: /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/
})}
Expand All @@ -90,8 +109,7 @@ const ContactForm = () => {
<div className='col'>
<input
type='text'
name='subject'
ref={register({
{...register('subject', {
required: { value: true, message: 'Please enter a subject' },
maxLength: {
value: 75,
Expand All @@ -111,8 +129,7 @@ const ContactForm = () => {
<div className='col'>
<textarea
rows={3}
name='message'
ref={register({
{...register('message', {
required: true
})}
className='form-control formInput'
Expand All @@ -121,7 +138,7 @@ const ContactForm = () => {
{errors.message && <span className='errorMessage'>Please enter a message</span>}
</div>
</div>
<button className='red-btn' type='submit'>
<button className='primary-btn' disabled={disabled} type='submit'>
Submit
</button>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { faEnvelope } from '@fortawesome/free-solid-svg-icons';
import { faPhone } from '@fortawesome/free-solid-svg-icons';
import { faMapMarkerAlt } from '@fortawesome/free-solid-svg-icons';

const ContactInfo = () => {
const ContactInfo: React.FC = () => {
return (
<div className='ContactForm'>
<div className='container'>
Expand Down
2 changes: 1 addition & 1 deletion src/components/footer.js → src/components/footer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

const Footer = () => {
const Footer: React.FC = () => {
return (
<div className='Footer'>
<div className='col-12 text-center copyright'>
Expand Down
6 changes: 3 additions & 3 deletions src/components/info.js → src/components/info.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import Headshot from '../images/profile-headshot.jpg';

const Info = () => {
const Info: React.FC = () => {
return (
<div className='Info'>
<div className='container'>
Expand All @@ -14,7 +14,7 @@ const Info = () => {
</div>
</div>
{/* Row 2 */}
<div className='row text-md-left text-center'>
<div className='row text-md-start text-center'>
<div className='col-md-6 mb-3'>
<img src={Headshot} className='img-fluid profile-picture' alt='Profile' />
</div>
Expand All @@ -27,7 +27,7 @@ const Info = () => {
working in a collaborative environment to create meaningful web applications and solve
programming challenges that benefit the end user.
</p>
<a href={`KeatonSentakResume.pdf`} target='_blank' rel='noopener noreferrer'>
<a href={`Keaton-Sentak-Resume.pdf`} target='_blank' rel='noopener noreferrer'>
<button className='resume-btn mt-2 mb-3'>Download Resume</button>
</a>
</div>
Expand Down
16 changes: 7 additions & 9 deletions src/components/layout.js → src/components/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import React from 'react';
import PropTypes from 'prop-types';

import React, { ReactNode } from 'react';
import Navbar from './navbar';
import 'bootstrap/dist/css/bootstrap.min.css';
import './main.css';
import '../styles/main.css';

interface LayoutProps {
children: ReactNode;
}

const Layout = ({ children }) => {
const Layout = ({ children }: LayoutProps) => {
return (
<>
<Navbar />
Expand All @@ -14,8 +16,4 @@ const Layout = ({ children }) => {
);
};

Layout.propTypes = {
children: PropTypes.node.isRequired
};

export default Layout;
12 changes: 6 additions & 6 deletions src/components/navbar.js → src/components/navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import React, { useState } from 'react';
import { Link } from 'gatsby';

const Navbar = () => {
const [menu, setAsOpen] = useState(false);
const Navbar: React.FC = () => {
const [menu, setAsOpen] = useState<boolean>(false);

const toggleNav = () => {
const toggleNav = (): void => {
setAsOpen(!menu);
};

const show = menu ? 'show' : '';
const show: string = menu ? 'show' : '';

return (
<div className='Navbar'>
<nav className='navbar navbar-expand-sm'>
<div className='container'>
<button
className='navbar-toggler ml-auto'
className='navbar-toggler ms-auto'
type='button'
aria-controls='navbarMobile'
aria-expanded='false'
Expand All @@ -25,7 +25,7 @@ const Navbar = () => {
<span className='navbar-toggler-icon' />
</button>
<div className={'collapse navbar-collapse ' + show} id='navbarMobile'>
<ul id='menu-primary' className='navbar-nav ml-auto'>
<ul id='menu-primary' className='navbar-nav ms-auto'>
{/* Home */}
<li onClick={toggleNav}>
<Link to='/' activeClassName='active' className='nav-Link'>
Expand Down
Loading

0 comments on commit 0c1227a

Please sign in to comment.