diff --git a/.gitignore b/.gitignore index 4d29575..e4451c4 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ npm-debug.log* yarn-debug.log* yarn-error.log* +dist diff --git a/README.md b/README.md index 02aac3f..595004a 100644 --- a/README.md +++ b/README.md @@ -1,70 +1,6 @@ -# Getting Started with Create React App +# MKRhere/pw2 -This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). +Available scripts -## Available Scripts - -In the project directory, you can run: - -### `yarn start` - -Runs the app in the development mode.\ -Open [http://localhost:3000](http://localhost:3000) to view it in the browser. - -The page will reload if you make edits.\ -You will also see any lint errors in the console. - -### `yarn test` - -Launches the test runner in the interactive watch mode.\ -See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. - -### `yarn build` - -Builds the app for production to the `build` folder.\ -It correctly bundles React in production mode and optimizes the build for the best performance. - -The build is minified and the filenames include the hashes.\ -Your app is ready to be deployed! - -See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. - -### `yarn eject` - -**Note: this is a one-way operation. Once you `eject`, you can’t go back!** - -If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. - -Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. - -You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. - -## Learn More - -You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). - -To learn React, check out the [React documentation](https://reactjs.org/). - -### Code Splitting - -This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) - -### Analyzing the Bundle Size - -This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) - -### Making a Progressive Web App - -This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) - -### Advanced Configuration - -This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) - -### Deployment - -This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) - -### `yarn build` fails to minify - -This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) +- `pnpm start` +- `pnpm build` diff --git a/package.json b/package.json index 5af3552..c4728ff 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ }, "dependencies": { "emotion": "^10.0.27", + "framer-motion": "^4.1.17", "react": "^17.0.2", "react-dom": "^17.0.2", "react-router-dom": "^5.2.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6349348..4fdda9f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7,6 +7,7 @@ specifiers: '@types/react-router-dom': ^5.1.8 '@vitejs/plugin-react-refresh': ^1.3.5 emotion: ^10.0.27 + framer-motion: ^4.1.17 react: ^17.0.2 react-dom: ^17.0.2 react-router-dom: ^5.2.0 @@ -16,6 +17,7 @@ specifiers: dependencies: emotion: 10.0.27 + framer-motion: 4.1.17_react-dom@17.0.2+react@17.0.2 react: 17.0.2 react-dom: 17.0.2_react@17.0.2 react-router-dom: 5.2.0_react@17.0.2 @@ -2503,6 +2505,13 @@ packages: resolution: {integrity: sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==} dev: false + /@emotion/is-prop-valid/0.8.8: + resolution: {integrity: sha512-u5WtneEAr5IDG2Wv65yhunPSMLIpuKsbuOktRojfrEiEvRyC85LgPMZI63cr7NUqT8ZIGdSVg8ZKGxIug4lXcA==} + dependencies: + '@emotion/memoize': 0.7.4 + dev: false + optional: true + /@emotion/memoize/0.7.4: resolution: {integrity: sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw==} dev: false @@ -6569,6 +6578,29 @@ packages: map-cache: 0.2.2 dev: true + /framer-motion/4.1.17_react-dom@17.0.2+react@17.0.2: + resolution: {integrity: sha512-thx1wvKzblzbs0XaK2X0G1JuwIdARcoNOW7VVwjO8BUltzXPyONGAElLu6CiCScsOQRI7FIk/45YTFtJw5Yozw==} + peerDependencies: + react: '>=16.8 || ^17.0.0' + react-dom: '>=16.8 || ^17.0.0' + dependencies: + framesync: 5.3.0 + hey-listen: 1.0.8 + popmotion: 9.3.6 + react: 17.0.2 + react-dom: 17.0.2_react@17.0.2 + style-value-types: 4.1.4 + tslib: 2.3.0 + optionalDependencies: + '@emotion/is-prop-valid': 0.8.8 + dev: false + + /framesync/5.3.0: + resolution: {integrity: sha512-oc5m68HDO/tuK2blj7ZcdEBRx3p1PjrgHazL8GYEpvULhrtGIFbQArN6cQS2QhW8mitffaB+VYzMjDqBxxQeoA==} + dependencies: + tslib: 2.3.0 + dev: false + /fresh/0.5.2: resolution: {integrity: sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=} engines: {node: '>= 0.6'} @@ -6894,6 +6926,10 @@ packages: resolution: {integrity: sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ==} dev: true + /hey-listen/1.0.8: + resolution: {integrity: sha512-COpmrF2NOg4TBWUJ5UVyaCU2A88wEMkUPK4hNqyCkqHbxT92BbvfjoSozkAIIm6XhicGlJHhFdullInrdhwU8Q==} + dev: false + /history/4.10.1: resolution: {integrity: sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew==} dependencies: @@ -9503,6 +9539,15 @@ packages: - typescript dev: true + /popmotion/9.3.6: + resolution: {integrity: sha512-ZTbXiu6zIggXzIliMi8LGxXBF5ST+wkpXGEjeTUDUOCdSQ356hij/xjeUdv0F8zCQNeqB1+PR5/BB+gC+QLAPw==} + dependencies: + framesync: 5.3.0 + hey-listen: 1.0.8 + style-value-types: 4.1.4 + tslib: 2.3.0 + dev: false + /portfinder/1.0.28: resolution: {integrity: sha512-Se+2isanIcEqf2XMHjyUKskczxbPH7dQnlMjXX6+dybayyHvAf/TCgyMRlzf/B6QDhAEFOGes0pzRo3by4AbMA==} engines: {node: '>= 0.12.0'} @@ -11676,6 +11721,13 @@ packages: webpack: 4.44.2 dev: true + /style-value-types/4.1.4: + resolution: {integrity: sha512-LCJL6tB+vPSUoxgUBt9juXIlNJHtBMy8jkXzUJSBzeHWdBu6lhzHqCvLVkXFGsFIlNa2ln1sQHya/gzaFmB2Lg==} + dependencies: + hey-listen: 1.0.8 + tslib: 2.3.0 + dev: false + /stylehacks/4.0.3: resolution: {integrity: sha512-7GlLk9JwlElY4Y6a/rmbH2MhVlTyVmiJd1PfTCqFaIBEGMYNsrO/v3SeGTdhBThLg4Z+NbOk/qFMwCa+J+3p/g==} engines: {node: '>=6.9.0'} @@ -11990,7 +12042,6 @@ packages: /tslib/2.3.0: resolution: {integrity: sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==} - dev: true /tsutils/3.21.0_typescript@4.3.5: resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} diff --git a/src/components/Container.tsx b/src/components/Container.tsx index a3f260c..4f99dc0 100644 --- a/src/components/Container.tsx +++ b/src/components/Container.tsx @@ -1,10 +1,11 @@ -import React, { useEffect, useRef, useLayoutEffect } from "react"; +import React, { useState, useEffect, useRef, useLayoutEffect } from "react"; import { css, cx } from "emotion"; import { Link, useHistory } from "react-router-dom"; import { ReactComponent as Logo } from "../assets/logo.svg"; import { ReactComponent as Right } from "../assets/arrow-right.svg"; import { getTimeout } from "../util"; +import Menu from "./Menu"; const flash = css` span& { @@ -40,6 +41,8 @@ const Container: React.FunctionComponent<{ const containerChild = useRef(null); const nextBtn = useRef(null); + const [showMenu, setShowMenu] = useState(false); + const children = React.Children.map( _children, (child: string | React.DetailedReactHTMLElement | React.ReactElement) => @@ -140,7 +143,9 @@ const Container: React.FunctionComponent<{ top: -0.1rem; left: -0.1rem; } - `}> + `} + onMouseOver={() => setShowMenu(true)} + onMouseOut={() => setShowMenu(false)}> + )} {next && ( @@ -196,7 +202,7 @@ const Container: React.FunctionComponent<{ fill: var(--primary-colour); } `}> - + )}
= ({ show = false }) => ( +
+
    li { + margin-left: 1rem; + + & > a { + text-decoration: none; + } + } + `}> + + {menu.map(item => ( + {item.name} + ))} + +
+
+); + +export default Menu; diff --git a/src/components/RevealChildren.tsx b/src/components/RevealChildren.tsx new file mode 100644 index 0000000..7bf3538 --- /dev/null +++ b/src/components/RevealChildren.tsx @@ -0,0 +1,33 @@ +import React from "react"; +import { motion } from "framer-motion"; + +const RevealChildren: React.FunctionComponent<{ + type: "div" | "span" | "li"; + children: React.ReactChild[]; + show: boolean; +}> = ({ type, children: items, show = false, ...props }) => { + const Comp = motion[type]; + const opacity = show ? 1 : 0; + const y = show ? 0 : -2; + + return ( + <> + {items.map((item, i) => ( + + {item} + + ))} + + ); +}; + +export default RevealChildren; diff --git a/src/index.css b/src/index.css index c7f7189..a3452be 100644 --- a/src/index.css +++ b/src/index.css @@ -2,10 +2,11 @@ --background-colour: rgb(0, 0, 0); --card-bg: rgb(18, 18, 18); --card-tags: rgb(34, 34, 34); + --card-tags-hover: rgb(25, 25, 25); --primary-colour: rgb(255, 85, 85); --text-colour: rgb(211, 207, 201); font-weight: 500; - font-size: 16px; + font-size: max(16px, 0.8vw); } * { diff --git a/src/pages/Projects.tsx b/src/pages/Projects.tsx index 877ce89..781bc96 100644 --- a/src/pages/Projects.tsx +++ b/src/pages/Projects.tsx @@ -70,7 +70,7 @@ const ProjectUnit: React.FunctionComponent = ({ title, url, description transition: all 200ms; :hover { - filter: hue-rotate(30deg) invert(0.05); + filter: hue-rotate(30deg) invert(0.04); transform: translateY(-0.2rem); } `}> @@ -109,7 +109,7 @@ const ProjectUnit: React.FunctionComponent = ({ title, url, description transition: all 200ms; :hover { - transform: translateY(-0.1rem); + background: var(--card-tags-hover); } & + & { diff --git a/vite.config.ts b/vite.config.ts index bda1042..afeeb96 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -5,9 +5,9 @@ import svgr from "@svgr/rollup"; // https://vitejs.dev/config/ export default defineConfig({ server: { - port: 10000, + port: 12000, hmr: { - port: 10000, + port: 12000, }, }, plugins: [