diff --git a/components/Header.js b/components/Header.js index eb65196..a64f26c 100644 --- a/components/Header.js +++ b/components/Header.js @@ -1,3 +1,4 @@ +/* eslint-disable jsx-a11y/anchor-is-valid */ import React, { useState } from 'react'; import PropTypes from 'prop-types'; import { motion } from 'framer-motion'; @@ -69,7 +70,7 @@ const Header = ({ return ( <> -
TYLER VERGHO
+
TYLER VERGHO
{typeof window !== 'undefined' && width > 768 && ( diff --git a/components/Portfolio.js b/components/Portfolio.js deleted file mode 100644 index 4a0a577..0000000 --- a/components/Portfolio.js +++ /dev/null @@ -1,11 +0,0 @@ -import React from 'react'; - -const Portfolio = ({ inputRef }) => { - return ( -
- 4 -
- ); -}; - -export default Portfolio; diff --git a/components/Portfolio/Backdrop.js b/components/Portfolio/Backdrop.js new file mode 100644 index 0000000..4c5e970 --- /dev/null +++ b/components/Portfolio/Backdrop.js @@ -0,0 +1,42 @@ +import React from 'react'; +import styles from 'styles/portfolio.module.scss'; +import { motion } from 'framer-motion'; +import useDelay from 'utils/useDelay'; +import PropTypes from 'prop-types'; + +const Backdrop = ({ + onMouseEnter, onMouseLeave, showBackdrop, height, width, title, description, technologies, href, +}) => { + const delayClose = useDelay(showBackdrop, 300, false, true); + const delayOpen = useDelay(showBackdrop, 300, true, false); + + return ( + + +

{title}

+ +
{description}
+
{technologies.join(', ')}
+
+
+ ); +}; + +Backdrop.propTypes = { + onMouseEnter: PropTypes.func, + onMouseLeave: PropTypes.func, + showBackdrop: PropTypes.bool.isRequired, + height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), + width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), + description: PropTypes.string, + technologies: PropTypes.arrayOf(PropTypes.string), + href: PropTypes.string, +}; + +export default Backdrop; diff --git a/components/Portfolio/Portfolio.js b/components/Portfolio/Portfolio.js new file mode 100644 index 0000000..c44f919 --- /dev/null +++ b/components/Portfolio/Portfolio.js @@ -0,0 +1,40 @@ +import React from 'react'; +import { useEmblaCarousel } from 'embla-carousel/react'; +import styles from 'styles/portfolio.module.scss'; +import PortfolioSlide from './PortfolioSlide'; + +const Portfolio = ({ inputRef }) => { + const [EmblaCarouselReact] = useEmblaCarousel({ loop: false }); + + return ( +
+ +
+ + + +
+
+
+ ); +}; + +export default Portfolio; diff --git a/components/Portfolio/PortfolioSlide.js b/components/Portfolio/PortfolioSlide.js new file mode 100644 index 0000000..373701f --- /dev/null +++ b/components/Portfolio/PortfolioSlide.js @@ -0,0 +1,74 @@ +import React, { useState, useEffect, useRef } from 'react'; +import useWindowSize from 'utils/useWindowSize'; +import styles from 'styles/portfolio.module.scss'; +import PropTypes from 'prop-types'; +import Backdrop from './Backdrop'; + +const PortfolioSlide = ({ + image, title, description, technologies, href, +}) => { + const [showBackdrop, setShowBackdrop] = useState(false); + + const imgRef = useRef(null); + const { width: windowWidth, height: windowHeight } = useWindowSize(); + const [width, setWidth] = useState(); + const [height, setHeight] = useState(); + + useEffect(() => { + if (imgRef?.current) { + const { naturalWidth, naturalHeight } = imgRef.current; + const maxWidth = windowWidth - 20; + const maxHeight = windowHeight * 0.7; + + const widthRatio = maxWidth / naturalWidth; + const heightRatio = maxHeight / naturalHeight; + + if (widthRatio <= heightRatio) { + console.log('resize width', naturalHeight, maxWidth); + setHeight(naturalHeight * (maxWidth / naturalWidth)); + setWidth(maxWidth); + } else { + console.log('resize height', naturalWidth, maxHeight); + setWidth(naturalWidth * (maxHeight / naturalHeight)); + setHeight(maxHeight); + } + } + }, [imgRef, windowWidth, windowHeight]); + + const onHover = () => { + setShowBackdrop(true); + }; + + const onUnhover = () => { + setShowBackdrop(false); + }; + + return ( +
+
+ {title} + +
+
+ ); +}; + +PortfolioSlide.propTypes = { + image: PropTypes.node.isRequired, + title: PropTypes.string, + description: PropTypes.string, + technologies: PropTypes.arrayOf(PropTypes.string), + href: PropTypes.string, +}; + +export default PortfolioSlide; diff --git a/components/Skills.js b/components/Skills.js index c643603..2fc1576 100644 --- a/components/Skills.js +++ b/components/Skills.js @@ -17,8 +17,8 @@ const SkillItem = ({
-
-
{name}
+
+
{name}