Skip to content

Commit

Permalink
Deploying Gatsby site to GitHub Pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Napalys committed Feb 7, 2024
1 parent d99a04c commit 57661ae
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
3 changes: 2 additions & 1 deletion gatsby-config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
pathPrefix: '/Portfolio',
plugins: [
`gatsby-plugin-sass`,
`gatsby-plugin-react-helmet`,
Expand Down Expand Up @@ -29,7 +30,7 @@ module.exports = {
background_color: `#fff`,
theme_color: `#02aab0`,
display: `standalone`,
icon: 'src/images/favicon.png',
icon: 'src/images/logos/cpp-logo.png',
},
},
],
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"version": "0.1.0",
"license": "MIT",
"scripts": {
"deploy": "gatsby build --prefix-paths && gh-pages -d public",
"build": "gatsby build",
"develop": "gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,json,md}\"",
Expand Down Expand Up @@ -49,6 +50,7 @@
"eslint-plugin-react": "^7.20.0",
"eslint-plugin-react-hooks": "^4.0.4",
"gatsby-plugin-image": "^3.12.3",
"gh-pages": "^6.1.1",
"lint-staged": "^10.2.11",
"prettier": "^2.0.5"
},
Expand Down
9 changes: 6 additions & 3 deletions src/components/About/About.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class About extends React.Component {

// Initial state
this.state = {
isDesktop: window.innerWidth > 869,
isMobile: window.innerWidth <= 869,
isDesktop: typeof window !== 'undefined' ? window.innerWidth > 869 : false,
isMobile: false,
};

// Variants for desktop (side fade)
Expand All @@ -28,7 +28,10 @@ class About extends React.Component {
}

getAnimationVariants() {
return window.matchMedia('(pointer: coarse)').matches;
if (typeof window !== 'undefined') {
return window.matchMedia('(pointer: coarse)').matches;
}
return false;
}

componentDidMount() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Footer/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import GithubButtons from './GithubButtons';
const Footer = () => {
const { footer } = useContext(PortfolioContext);
const { networks } = footer;
const isMobile = window.matchMedia('(pointer: coarse)').matches;
const isMobile = typeof window !== 'undefined' && window.matchMedia('(pointer: coarse)').matches;

return (
<footer className="footer navbar-static-bottom">
Expand Down
18 changes: 6 additions & 12 deletions src/components/Hero/Hero.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,10 @@ import {
class Header extends React.Component {
constructor(props) {
super(props);
if (window.innerWidth > 869) {
this.state = {
isDesktop: true,
isMobile: false,
};
} else {
this.state = {
isMobile: true,
isDesktop: false,
};
}
this.state = {
isDesktop: typeof window !== 'undefined' ? window.innerWidth > 869 : false,
isMobile: false,
};
}

componentDidMount() {
Expand All @@ -40,7 +33,8 @@ class Header extends React.Component {
cta: "Let's talk ?",
};
const { isDesktop } = this.state;
const isMobile = window.matchMedia('(pointer: coarse)').matches;
const isMobile =
typeof window !== 'undefined' && window.matchMedia('(pointer: coarse)').matches;

// Variants for desktop (left fade)
const desktopVariants = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Projects/Projects.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const CustomArrow = ({ direction, onClick }) => {
};
const carouselProps = {
showArrows: true,
autoPlay: false,
autoPlay: true,
infiniteLoop: true,
showStatus: false,
showIndicators: false,
Expand Down

0 comments on commit 57661ae

Please sign in to comment.