├── .gitignore ├── README.md ├── package-lock.json ├── package.json ├── public ├── favicon.ico ├── index.html ├── logo192.png ├── logo512.png ├── manifest.json └── robots.txt ├── src ├── App.tsx ├── index.css ├── index.tsx ├── navbars │ ├── navbar-1 │ │ ├── 1.svg │ │ ├── 2.svg │ │ ├── 3.svg │ │ ├── Navbar.tsx │ │ ├── logo.svg │ │ └── styles.css │ └── navbar-2 │ │ ├── Navbar.tsx │ │ └── styles.css └── react-app-env.d.ts └── tsconfig.json /.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 | ### `npm 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 | ### `npm 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 | ### `npm run 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 | ### `npm run 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 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-navbars", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@types/node": "^16.11.62", 7 | "@types/react": "^18.0.21", 8 | "@types/react-dom": "^18.0.6", 9 | "react": "^18.2.0", 10 | "react-dom": "^18.2.0", 11 | "react-scripts": "5.0.1", 12 | "swiper": "^9.1.1", 13 | "typescript": "^4.8.4" 14 | }, 15 | "scripts": { 16 | "start": "react-scripts start", 17 | "build": "react-scripts build" 18 | }, 19 | "eslintConfig": { 20 | "extends": [ 21 | "react-app" 22 | ] 23 | }, 24 | "browserslist": { 25 | "production": [ 26 | ">0.2%", 27 | "not dead", 28 | "not op_mini all" 29 | ], 30 | "development": [ 31 | "last 1 chrome version", 32 | "last 1 firefox version", 33 | "last 1 safari version" 34 | ] 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frontend-joe/react-navbars/afa60dc18926b62f6af378fc4506f53b56ec75fd/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | 28 | 29 | 33 | 37 | React App 38 | 39 | 40 | 41 |
42 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frontend-joe/react-navbars/afa60dc18926b62f6af378fc4506f53b56ec75fd/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frontend-joe/react-navbars/afa60dc18926b62f6af378fc4506f53b56ec75fd/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.tsx: -------------------------------------------------------------------------------- 1 | import { Navbar } from "./navbars/navbar-2/Navbar"; 2 | 3 | function App() { 4 | return ; 5 | } 6 | 7 | export default App; 8 | -------------------------------------------------------------------------------- /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.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom/client"; 3 | import "./index.css"; 4 | import App from "./App"; 5 | 6 | const root = ReactDOM.createRoot( 7 | document.getElementById("root") as HTMLElement 8 | ); 9 | root.render( 10 | 11 | 12 | 13 | ); 14 | -------------------------------------------------------------------------------- /src/navbars/navbar-1/1.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/navbars/navbar-1/2.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/navbars/navbar-1/3.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/navbars/navbar-1/Navbar.tsx: -------------------------------------------------------------------------------- 1 | import "./styles.css"; 2 | import logo from "./logo.svg"; 3 | import image1 from "./1.svg"; 4 | import image2 from "./2.svg"; 5 | import image3 from "./3.svg"; 6 | import { useEffect, useRef, useState } from "react"; 7 | 8 | export const Navbar = () => { 9 | const lastScrollTop = useRef(0); 10 | 11 | const [isNavbarVisible, setIsNavbarVisible] = useState(true); 12 | 13 | useEffect(() => { 14 | window.addEventListener( 15 | "scroll", 16 | () => { 17 | var { pageYOffset } = window; 18 | if (pageYOffset > lastScrollTop.current) { 19 | // downward scroll 20 | setIsNavbarVisible(false); 21 | } else if (pageYOffset < lastScrollTop.current) { 22 | // upward scroll 23 | setIsNavbarVisible(true); 24 | } // else was horizontal scroll 25 | lastScrollTop.current = pageYOffset <= 0 ? 0 : pageYOffset; 26 | }, 27 | { passive: true } 28 | ); 29 | }, []); 30 | 31 | return ( 32 | <> 33 | 41 |
42 |
43 |

Portfolio

44 |

45 | Lorem ipsum dolor, sit amet consectetur adipisicing elit. Esse 46 | itaque corporis optio unde quia, modi pariatur ea magni dolorum? 47 |

48 |
49 | 50 |
51 |
52 | 53 |
54 |

Skills

55 |

56 | Lorem ipsum dolor, sit amet consectetur adipisicing elit. Esse 57 | itaque corporis optio unde quia, modi pariatur ea magni dolorum? 58 |

59 |
60 |
61 |
62 |
63 |

About

64 |

65 | Lorem ipsum dolor, sit amet consectetur adipisicing elit. Esse 66 | itaque corporis optio unde quia, modi pariatur ea magni dolorum? 67 |

68 |
69 | 70 |
71 |
72 | 73 |
74 |

Contact

75 |

76 | Lorem ipsum dolor, sit amet consectetur adipisicing elit. Esse 77 | itaque corporis optio unde quia, modi pariatur ea magni dolorum? 78 |

79 |
80 |
81 |
82 |
83 |

My Skills

84 |

85 | Lorem ipsum dolor, sit amet consectetur adipisicing elit. Esse 86 | itaque corporis optio unde quia, modi pariatur ea magni dolorum? 87 |

88 |
89 | 90 |
91 |
92 | 93 |
94 |

My Skills

95 |

96 | Lorem ipsum dolor, sit amet consectetur adipisicing elit. Esse 97 | itaque corporis optio unde quia, modi pariatur ea magni dolorum? 98 |

99 |
100 |
101 |
102 |
103 |

My Skills

104 |

105 | Lorem ipsum dolor, sit amet consectetur adipisicing elit. Esse 106 | itaque corporis optio unde quia, modi pariatur ea magni dolorum? 107 |

108 |
109 | 110 |
111 | 112 | ); 113 | }; 114 | -------------------------------------------------------------------------------- /src/navbars/navbar-1/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/navbars/navbar-1/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | color: #4c4b5b; 3 | font-family: "Euclid Circular A", "Poppins"; 4 | padding-top: 72px; 5 | } 6 | 7 | * { 8 | box-sizing: border-box; 9 | } 10 | 11 | button, 12 | a { 13 | cursor: pointer; 14 | transition: 0.3s; 15 | color: inherit; 16 | font-weight: 600; 17 | } 18 | 19 | nav { 20 | position: fixed; 21 | top: 0; 22 | left: 0; 23 | translate: 0 -72px; 24 | display: flex; 25 | align-items: center; 26 | justify-content: space-between; 27 | gap: 20px; 28 | padding: 0 20px; 29 | width: 100%; 30 | height: 72px; 31 | box-shadow: 0 10px 20px rgb(0 0 0 / 10%); 32 | background: #6b63ff; 33 | transition: 0.3s; 34 | } 35 | 36 | nav.visible { 37 | top: 0; 38 | translate: 0; 39 | } 40 | 41 | nav > img { 42 | width: 50px; 43 | height: 50px; 44 | border-radius: 50%; 45 | } 46 | 47 | .nav-items { 48 | display: flex; 49 | align-items: center; 50 | gap: 16px; 51 | } 52 | 53 | .nav-items > a { 54 | text-decoration: none; 55 | color: rgb(255 255 255 / 96%); 56 | height: 72px; 57 | display: grid; 58 | place-items: center; 59 | } 60 | 61 | .nav-items > a:hover { 62 | color: rgb(255 255 255 / 96%); 63 | } 64 | 65 | h2 { 66 | font-size: 20px; 67 | margin: 0 0 4px; 68 | cursor: default; 69 | } 70 | 71 | section { 72 | display: flex; 73 | align-items: center; 74 | gap: 40px; 75 | padding: 100px 60px; 76 | } 77 | 78 | section.shaded { 79 | background: #f9f9ff; 80 | } 81 | 82 | section > img { 83 | width: 200px; 84 | height: 200px; 85 | border-radius: 50%; 86 | object-fit: contain; 87 | padding: 50px; 88 | background: #f9f9ff; 89 | } 90 | 91 | section.shaded > img { 92 | padding: 20px; 93 | } 94 | 95 | section > p { 96 | line-height: 1.7; 97 | } 98 | -------------------------------------------------------------------------------- /src/navbars/navbar-2/Navbar.tsx: -------------------------------------------------------------------------------- 1 | import { useEffect, useState } from "react"; 2 | import "./styles.css"; 3 | 4 | const navItems = ["home", "settings", "lock"]; 5 | 6 | export const Navbar = () => { 7 | const [activeIndex, setActiveIndex] = useState(0); 8 | 9 | const handleScroll = () => { 10 | const { pageYOffset, innerHeight } = window; 11 | 12 | const currentIndex = Math.floor(pageYOffset / (innerHeight - 200)); 13 | 14 | if (currentIndex !== activeIndex) { 15 | setActiveIndex(currentIndex); 16 | } 17 | }; 18 | 19 | useEffect(() => { 20 | window.addEventListener("scroll", handleScroll); 21 | }); 22 | 23 | return ( 24 | <> 25 | 40 |
41 |
42 |

Home

43 |

44 | Lorem ipsum dolor sit amet consectetur adipisicing elit. Qui 45 | doloribus labore totam quis aut, nulla, et facere voluptatibus 46 | architecto nostrum, odio corporis quae quibusdam molestiae numquam 47 | ratione omnis. Doloribus, voluptates. 48 |

49 |
50 |
51 |

Settings

52 |

53 | Lorem ipsum dolor sit amet consectetur adipisicing elit. Qui 54 | doloribus labore totam quis aut, nulla, et facere voluptatibus 55 | architecto nostrum, odio corporis quae quibusdam molestiae numquam 56 | ratione omnis. Doloribus, voluptates. 57 |

58 |
59 |
60 |

Account

61 |

62 | Lorem ipsum dolor sit amet consectetur adipisicing elit. Qui 63 | doloribus labore totam quis aut, nulla, et facere voluptatibus 64 | architecto nostrum, odio corporis quae quibusdam molestiae numquam 65 | ratione omnis. Doloribus, voluptates. 66 |

67 |
68 |
69 | 70 | ); 71 | }; 72 | -------------------------------------------------------------------------------- /src/navbars/navbar-2/styles.css: -------------------------------------------------------------------------------- 1 | * { 2 | box-sizing: border-box; 3 | } 4 | 5 | :root { 6 | --sidebar-width: 56px; 7 | } 8 | 9 | html { 10 | scroll-behavior: smooth; 11 | } 12 | 13 | body { 14 | padding-left: var(--sidebar-width); 15 | font-family: "Euclid Circular A", "Poppins"; 16 | color: #47454d; 17 | } 18 | 19 | aside { 20 | position: fixed; 21 | top: 0; 22 | left: 0; 23 | bottom: 0; 24 | display: grid; 25 | place-items: center; 26 | width: var(--sidebar-width); 27 | background: #6644fd; 28 | } 29 | 30 | nav { 31 | position: relative; 32 | display: flex; 33 | align-items: center; 34 | justify-content: center; 35 | flex-direction: column; 36 | } 37 | 38 | .background { 39 | position: absolute; 40 | z-index: -1; 41 | top: 0; 42 | left: 0; 43 | width: var(--sidebar-width); 44 | height: var(--sidebar-width); 45 | display: grid; 46 | place-items: center; 47 | transition: 0.3s; 48 | } 49 | 50 | .background::after { 51 | content: ""; 52 | display: block; 53 | width: 40px; 54 | height: 40px; 55 | border-radius: 50%; 56 | background: rgb(0 0 0 / 40%); 57 | } 58 | 59 | nav a { 60 | display: grid; 61 | place-items: center; 62 | width: var(--sidebar-width); 63 | height: var(--sidebar-width); 64 | padding: 10px; 65 | color: #f9f9f9; 66 | text-decoration: none; 67 | cursor: pointer; 68 | } 69 | 70 | section { 71 | height: 100vh; 72 | padding: 0 60px; 73 | display: flex; 74 | justify-content: center; 75 | flex-direction: column; 76 | } 77 | 78 | section:nth-child(even) { 79 | background: #f9f8fe; 80 | } 81 | 82 | section p { 83 | max-width: 600px; 84 | } 85 | -------------------------------------------------------------------------------- /src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "esModuleInterop": true, 12 | "allowSyntheticDefaultImports": true, 13 | "strict": true, 14 | "forceConsistentCasingInFileNames": true, 15 | "noFallthroughCasesInSwitch": true, 16 | "module": "esnext", 17 | "moduleResolution": "node", 18 | "resolveJsonModule": true, 19 | "isolatedModules": true, 20 | "noEmit": true, 21 | "jsx": "react-jsx" 22 | }, 23 | "include": [ 24 | "src" 25 | ] 26 | } 27 | --------------------------------------------------------------------------------