├── .env ├── .eslintcache ├── .gitignore ├── README.md ├── package.json ├── public ├── favicon.ico ├── index.html ├── logo192.png ├── logo512.png ├── manifest.json └── robots.txt ├── src ├── App.css ├── App.js ├── App.test.js ├── animations │ └── index.js ├── components │ ├── Header.js │ └── Hero.js ├── globalStyles.js ├── images │ ├── img-1.jpg │ ├── img-2.jpg │ └── img-3.jpg ├── index.css ├── index.js ├── pages │ ├── About.js │ ├── Home.js │ └── Services.js ├── reportWebVitals.js └── setupTests.js └── yarn.lock /.env: -------------------------------------------------------------------------------- 1 | SKIP_PREFLIGHT_CHECK=true -------------------------------------------------------------------------------- /.eslintcache: -------------------------------------------------------------------------------- 1 | [{"/Users/main/Desktop/Projects/1youtube-projects/react-page-transitions-v1/src/index.js":"1","/Users/main/Desktop/Projects/1youtube-projects/react-page-transitions-v1/src/App.js":"2","/Users/main/Desktop/Projects/1youtube-projects/react-page-transitions-v1/src/reportWebVitals.js":"3","/Users/main/Desktop/Projects/1youtube-projects/react-page-transitions-v1/src/components/Hero.js":"4","/Users/main/Desktop/Projects/1youtube-projects/react-page-transitions-v1/src/components/Header.js":"5","/Users/main/Desktop/Projects/1youtube-projects/react-page-transitions-v1/src/pages/Home.js":"6","/Users/main/Desktop/Projects/1youtube-projects/react-page-transitions-v1/src/pages/Services.js":"7","/Users/main/Desktop/Projects/1youtube-projects/react-page-transitions-v1/src/pages/About.js":"8","/Users/main/Desktop/Projects/1youtube-projects/react-page-transitions-v1/src/globalStyles.js":"9","/Users/main/Desktop/Projects/1youtube-projects/react-page-transitions-v1/src/animations/index.js":"10"},{"size":589,"mtime":1607573220925,"results":"11","hashOfConfig":"12"},{"size":828,"mtime":1607573291560,"results":"13","hashOfConfig":"12"},{"size":362,"mtime":1607569942465,"results":"14","hashOfConfig":"12"},{"size":1122,"mtime":1607571408955,"results":"15","hashOfConfig":"12"},{"size":898,"mtime":1607570995745,"results":"16","hashOfConfig":"12"},{"size":565,"mtime":1607572825289,"results":"17","hashOfConfig":"12"},{"size":584,"mtime":1607573074378,"results":"18","hashOfConfig":"12"},{"size":505,"mtime":1607573008502,"results":"19","hashOfConfig":"12"},{"size":308,"mtime":1607572537641,"results":"20","hashOfConfig":"12"},{"size":440,"mtime":1607572938960,"results":"21","hashOfConfig":"12"},{"filePath":"22","messages":"23","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},"1k6uzx3",{"filePath":"25","messages":"26","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},{"filePath":"27","messages":"28","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},{"filePath":"29","messages":"30","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},{"filePath":"31","messages":"32","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},{"filePath":"33","messages":"34","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},{"filePath":"35","messages":"36","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},{"filePath":"37","messages":"38","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},{"filePath":"39","messages":"40","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"24"},{"filePath":"41","messages":"42","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/main/Desktop/Projects/1youtube-projects/react-page-transitions-v1/src/index.js",[],["43","44"],"/Users/main/Desktop/Projects/1youtube-projects/react-page-transitions-v1/src/App.js",[],"/Users/main/Desktop/Projects/1youtube-projects/react-page-transitions-v1/src/reportWebVitals.js",[],"/Users/main/Desktop/Projects/1youtube-projects/react-page-transitions-v1/src/components/Hero.js",[],"/Users/main/Desktop/Projects/1youtube-projects/react-page-transitions-v1/src/components/Header.js",[],"/Users/main/Desktop/Projects/1youtube-projects/react-page-transitions-v1/src/pages/Home.js",[],"/Users/main/Desktop/Projects/1youtube-projects/react-page-transitions-v1/src/pages/Services.js",[],"/Users/main/Desktop/Projects/1youtube-projects/react-page-transitions-v1/src/pages/About.js",[],"/Users/main/Desktop/Projects/1youtube-projects/react-page-transitions-v1/src/globalStyles.js",[],"/Users/main/Desktop/Projects/1youtube-projects/react-page-transitions-v1/src/animations/index.js",[],{"ruleId":"45","replacedBy":"46"},{"ruleId":"47","replacedBy":"48"},"no-native-reassign",["49"],"no-negated-in-lhs",["50"],"no-global-assign","no-unsafe-negation"] -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Getting Started with Create React App 2 | 3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 4 | 5 | ## Available Scripts 6 | 7 | In the project directory, you can run: 8 | 9 | ### `yarn start` 10 | 11 | Runs the app in the development mode.\ 12 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 13 | 14 | The page will reload if you make edits.\ 15 | You will also see any lint errors in the console. 16 | 17 | ### `yarn test` 18 | 19 | Launches the test runner in the interactive watch mode.\ 20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 21 | 22 | ### `yarn build` 23 | 24 | Builds the app for production to the `build` folder.\ 25 | It correctly bundles React in production mode and optimizes the build for the best performance. 26 | 27 | The build is minified and the filenames include the hashes.\ 28 | Your app is ready to be deployed! 29 | 30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 31 | 32 | ### `yarn eject` 33 | 34 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 35 | 36 | 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. 37 | 38 | 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. 39 | 40 | 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. 41 | 42 | ## Learn More 43 | 44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 45 | 46 | To learn React, check out the [React documentation](https://reactjs.org/). 47 | 48 | ### Code Splitting 49 | 50 | 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) 51 | 52 | ### Analyzing the Bundle Size 53 | 54 | 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) 55 | 56 | ### Making a Progressive Web App 57 | 58 | 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) 59 | 60 | ### Advanced Configuration 61 | 62 | 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) 63 | 64 | ### Deployment 65 | 66 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) 67 | 68 | ### `yarn build` fails to minify 69 | 70 | 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) 71 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-page-transitions-v1", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@testing-library/jest-dom": "^5.11.4", 7 | "@testing-library/react": "^11.1.0", 8 | "@testing-library/user-event": "^12.1.10", 9 | "framer-motion": "^2.9.5", 10 | "react": "^17.0.1", 11 | "react-dom": "^17.0.1", 12 | "react-router-dom": "^5.2.0", 13 | "react-scripts": "4.0.1", 14 | "styled-components": "^5.2.1", 15 | "web-vitals": "^0.2.4" 16 | }, 17 | "scripts": { 18 | "start": "react-scripts start", 19 | "build": "react-scripts build", 20 | "test": "react-scripts test", 21 | "eject": "react-scripts eject" 22 | }, 23 | "eslintConfig": { 24 | "extends": [ 25 | "react-app", 26 | "react-app/jest" 27 | ] 28 | }, 29 | "browserslist": { 30 | "production": [ 31 | ">0.2%", 32 | "not dead", 33 | "not op_mini all" 34 | ], 35 | "development": [ 36 | "last 1 chrome version", 37 | "last 1 firefox version", 38 | "last 1 safari version" 39 | ] 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/briancodex/react-page-transitions-v1/73b601c645facda3cfdaecc62ec102bf57b95bc8/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | React App 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/briancodex/react-page-transitions-v1/73b601c645facda3cfdaecc62ec102bf57b95bc8/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/briancodex/react-page-transitions-v1/73b601c645facda3cfdaecc62ec102bf57b95bc8/public/logo512.png -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | height: 40vmin; 7 | pointer-events: none; 8 | } 9 | 10 | @media (prefers-reduced-motion: no-preference) { 11 | .App-logo { 12 | animation: App-logo-spin infinite 20s linear; 13 | } 14 | } 15 | 16 | .App-header { 17 | background-color: #282c34; 18 | min-height: 100vh; 19 | display: flex; 20 | flex-direction: column; 21 | align-items: center; 22 | justify-content: center; 23 | font-size: calc(10px + 2vmin); 24 | color: white; 25 | } 26 | 27 | .App-link { 28 | color: #61dafb; 29 | } 30 | 31 | @keyframes App-logo-spin { 32 | from { 33 | transform: rotate(0deg); 34 | } 35 | to { 36 | transform: rotate(360deg); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/App.js: -------------------------------------------------------------------------------- 1 | import './App.css'; 2 | import { Switch, Route, useLocation } from 'react-router-dom'; 3 | import Home from './pages/Home'; 4 | import About from './pages/About'; 5 | import Services from './pages/Services'; 6 | import { AnimatePresence } from 'framer-motion'; 7 | import GlobalStyle from './globalStyles'; 8 | import styled from 'styled-components'; 9 | 10 | const Section = styled.section` 11 | overflow-x: hidden; 12 | `; 13 | 14 | function App() { 15 | let location = useLocation(); 16 | 17 | return ( 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | ); 29 | } 30 | 31 | export default App; 32 | -------------------------------------------------------------------------------- /src/App.test.js: -------------------------------------------------------------------------------- 1 | import { render, screen } from '@testing-library/react'; 2 | import App from './App'; 3 | 4 | test('renders learn react link', () => { 5 | render(); 6 | const linkElement = screen.getByText(/learn react/i); 7 | expect(linkElement).toBeInTheDocument(); 8 | }); 9 | -------------------------------------------------------------------------------- /src/animations/index.js: -------------------------------------------------------------------------------- 1 | export const animationOne = { 2 | in: { 3 | opacity: 1 4 | }, 5 | out: { 6 | opacity: 0 7 | } 8 | }; 9 | 10 | export const animationTwo = { 11 | in: { 12 | opacity: 1, 13 | y: 0, 14 | scale: 1 15 | }, 16 | out: { 17 | opacity: 0, 18 | y: '-100vh', 19 | scale: 0.3 20 | } 21 | }; 22 | 23 | export const animationThree = { 24 | in: { 25 | opacity: 1, 26 | x: -300 27 | }, 28 | out: { 29 | opacity: 0, 30 | x: 300 31 | }, 32 | end: { 33 | x: 0, 34 | opacity: 1 35 | } 36 | }; 37 | 38 | export const transition = { 39 | duration: 0.4 40 | }; 41 | -------------------------------------------------------------------------------- /src/components/Header.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Link } from 'react-router-dom'; 3 | import styled from 'styled-components'; 4 | 5 | const Navbar = styled.nav` 6 | height: 60px; 7 | background: transparent; 8 | padding: 0rem calc((100vw - 1300px) / 2); 9 | display: flex; 10 | justify-content: space-between; 11 | align-items: center; 12 | `; 13 | 14 | const Logo = styled(Link)` 15 | color: #fff; 16 | padding-left: 1rem; 17 | text-decoration: none; 18 | font-size: 1.5rem; 19 | font-weight: bold; 20 | font-style: italic; 21 | `; 22 | 23 | const NavItems = styled.div``; 24 | 25 | const NavbarLink = styled(Link)` 26 | color: #fff; 27 | text-decoration: none; 28 | padding: 1rem; 29 | `; 30 | 31 | const Header = () => { 32 | return ( 33 | 34 | Animal 35 | 36 | Home 37 | About 38 | Services 39 | 40 | 41 | ); 42 | }; 43 | 44 | export default Header; 45 | -------------------------------------------------------------------------------- /src/components/Hero.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import styled from 'styled-components'; 3 | 4 | const Section = styled.section` 5 | background: url(${({ image }) => image && image}) center; 6 | height: 100vh; 7 | display: flex; 8 | justify-content: flex-start; 9 | align-items: flex-end; 10 | margin-top: -60px; 11 | `; 12 | 13 | const Container = styled.div` 14 | color: #fff; 15 | padding: 2rem; 16 | backdrop-filter: blur(5px); 17 | background-color: rgba(0, 0, 0, 0.4); 18 | margin: 2rem; 19 | border-radius: 10px; 20 | 21 | h1 { 22 | font-size: clamp(2rem, 8vw, 5rem); 23 | margin-bottom: 0.5rem; 24 | } 25 | 26 | p { 27 | font-size: clamp(1rem, 6vw, 2.5rem); 28 | margin-bottom: 1rem; 29 | } 30 | 31 | button { 32 | font-size: clamp(0.8rem, 4vw, 1.2rem); 33 | padding: 0.8rem 2rem; 34 | color: #000; 35 | background: #ffb347; 36 | background: linear-gradient(to right, #ffcc33, #ffb347); 37 | border: none; 38 | border-radius: 4px; 39 | cursor: pointer; 40 | outline: none; 41 | } 42 | `; 43 | 44 | const Hero = ({ image, title, desc }) => { 45 | return ( 46 |
47 | 48 |

{title}

49 |

{desc}

50 | 51 |
52 |
53 | ); 54 | }; 55 | 56 | export default Hero; 57 | -------------------------------------------------------------------------------- /src/globalStyles.js: -------------------------------------------------------------------------------- 1 | import { createGlobalStyle } from 'styled-components'; 2 | 3 | const GlobalStyle = createGlobalStyle` 4 | * { 5 | margin: 0; 6 | padding: 0; 7 | box-sizing: border-box; 8 | font-family: Open-'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; 9 | } 10 | `; 11 | 12 | export default GlobalStyle; 13 | -------------------------------------------------------------------------------- /src/images/img-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/briancodex/react-page-transitions-v1/73b601c645facda3cfdaecc62ec102bf57b95bc8/src/images/img-1.jpg -------------------------------------------------------------------------------- /src/images/img-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/briancodex/react-page-transitions-v1/73b601c645facda3cfdaecc62ec102bf57b95bc8/src/images/img-2.jpg -------------------------------------------------------------------------------- /src/images/img-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/briancodex/react-page-transitions-v1/73b601c645facda3cfdaecc62ec102bf57b95bc8/src/images/img-3.jpg -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | import reportWebVitals from './reportWebVitals'; 6 | import { BrowserRouter as Router } from 'react-router-dom'; 7 | 8 | ReactDOM.render( 9 | 10 | 11 | 12 | 13 | , 14 | document.getElementById('root') 15 | ); 16 | 17 | // If you want to start measuring performance in your app, pass a function 18 | // to log results (for example: reportWebVitals(console.log)) 19 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 20 | reportWebVitals(); 21 | -------------------------------------------------------------------------------- /src/pages/About.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Header from '../components/Header'; 3 | import Hero from '../components/Hero'; 4 | import Image from '../images/img-2.jpg'; 5 | import { motion } from 'framer-motion'; 6 | import { animationTwo } from '../animations'; 7 | 8 | const About = () => { 9 | return ( 10 | 11 |
12 | 13 | About 14 | 15 | ); 16 | }; 17 | 18 | export default About; 19 | -------------------------------------------------------------------------------- /src/pages/Home.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Header from '../components/Header'; 3 | import Hero from '../components/Hero'; 4 | import Image from '../images/img-1.jpg'; 5 | import { motion } from 'framer-motion'; 6 | import { animationOne, transition } from '../animations'; 7 | 8 | const Home = () => { 9 | return ( 10 | 17 |
18 | 19 | 20 | ); 21 | }; 22 | 23 | export default Home; 24 | -------------------------------------------------------------------------------- /src/pages/Services.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Header from '../components/Header'; 3 | import Hero from '../components/Hero'; 4 | import Image from '../images/img-3.jpg'; 5 | import { motion } from 'framer-motion'; 6 | import { animationThree } from '../animations'; 7 | 8 | const Services = () => { 9 | return ( 10 | 16 |
17 | 22 | Services 23 | 24 | ); 25 | }; 26 | 27 | export default Services; 28 | -------------------------------------------------------------------------------- /src/reportWebVitals.js: -------------------------------------------------------------------------------- 1 | const reportWebVitals = onPerfEntry => { 2 | if (onPerfEntry && onPerfEntry instanceof Function) { 3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 4 | getCLS(onPerfEntry); 5 | getFID(onPerfEntry); 6 | getFCP(onPerfEntry); 7 | getLCP(onPerfEntry); 8 | getTTFB(onPerfEntry); 9 | }); 10 | } 11 | }; 12 | 13 | export default reportWebVitals; 14 | -------------------------------------------------------------------------------- /src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | --------------------------------------------------------------------------------