├── images
├── icon-arrow-down.svg
├── icon-arrow-up.svg
├── favicon-32x32.png
├── image-hero-mobile.png
├── icon-menu.svg
├── image-hero-desktop.png
├── icon-close-menu.svg
├── icon-todo.svg
├── icon-calendar.svg
├── icon-planning.svg
├── icon-reminders.svg
├── client-audiophile.svg
├── client-meet.svg
├── client-maker.svg
├── logo.svg
└── client-databiz.svg
├── design
├── active-states.jpg
├── desktop-design.jpg
├── desktop-preview.jpg
├── mobile-design.jpg
├── mobile-menu-expanded.jpg
└── mobile-menu-collapsed.jpg
├── style-guide.md
├── .gitignore
├── script.js
├── LICENSE
├── README.md
├── index.html
└── style.css
/images/icon-arrow-down.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/images/icon-arrow-up.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/design/active-states.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/all-my-frontend-mini-projects/Intro-section-with-dropdown-navigation_frontend_project/HEAD/design/active-states.jpg
--------------------------------------------------------------------------------
/design/desktop-design.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/all-my-frontend-mini-projects/Intro-section-with-dropdown-navigation_frontend_project/HEAD/design/desktop-design.jpg
--------------------------------------------------------------------------------
/design/desktop-preview.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/all-my-frontend-mini-projects/Intro-section-with-dropdown-navigation_frontend_project/HEAD/design/desktop-preview.jpg
--------------------------------------------------------------------------------
/design/mobile-design.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/all-my-frontend-mini-projects/Intro-section-with-dropdown-navigation_frontend_project/HEAD/design/mobile-design.jpg
--------------------------------------------------------------------------------
/images/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/all-my-frontend-mini-projects/Intro-section-with-dropdown-navigation_frontend_project/HEAD/images/favicon-32x32.png
--------------------------------------------------------------------------------
/images/image-hero-mobile.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/all-my-frontend-mini-projects/Intro-section-with-dropdown-navigation_frontend_project/HEAD/images/image-hero-mobile.png
--------------------------------------------------------------------------------
/design/mobile-menu-expanded.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/all-my-frontend-mini-projects/Intro-section-with-dropdown-navigation_frontend_project/HEAD/design/mobile-menu-expanded.jpg
--------------------------------------------------------------------------------
/images/icon-menu.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/images/image-hero-desktop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/all-my-frontend-mini-projects/Intro-section-with-dropdown-navigation_frontend_project/HEAD/images/image-hero-desktop.png
--------------------------------------------------------------------------------
/design/mobile-menu-collapsed.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/all-my-frontend-mini-projects/Intro-section-with-dropdown-navigation_frontend_project/HEAD/design/mobile-menu-collapsed.jpg
--------------------------------------------------------------------------------
/images/icon-close-menu.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/images/icon-todo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/images/icon-calendar.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/images/icon-planning.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/images/icon-reminders.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/style-guide.md:
--------------------------------------------------------------------------------
1 | # Front-end Style Guide
2 |
3 | ## Layout
4 |
5 | The designs were created to the following widths:
6 |
7 | - Mobile: 375px
8 | - Desktop: 1440px
9 |
10 | ## Colors
11 |
12 | ### Neutral
13 |
14 | - Almost White: hsl(0, 0%, 98%)
15 | - Medium Gray: hsl(0, 0%, 41%)
16 | - Almost Black: hsl(0, 0%, 8%)
17 |
18 | ## Typography
19 |
20 | ### Body Copy
21 |
22 | - Font size (paragraph): 18px
23 |
24 | ### Font
25 |
26 | - Family: [Epilogue](https://fonts.google.com/specimen/Epilogue)
27 | - Weights: 500, 700
28 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Avoid accidental upload of the Sketch and Figma design files
2 | #####################################################
3 | ## Please do not remove lines 5 and 6 - thanks! 🙂 ##
4 | #####################################################
5 | *.sketch
6 | *.fig
7 |
8 | # Avoid accidental XD upload if you convert the design file
9 | ###############################################
10 | ## Please do not remove line 12 - thanks! 🙂 ##
11 | ###############################################
12 | *.xd
13 |
14 | # Avoid your project being littered with annoying .DS_Store files!
15 | .DS_Store
16 | .prettierignore
--------------------------------------------------------------------------------
/script.js:
--------------------------------------------------------------------------------
1 | const navLinkTitles = document.querySelectorAll(".nav-link-title");
2 | const navBar = document.getElementById("navBar");
3 | const btnHamburger = document.getElementById("btnHamburger");
4 | const btnClose = document.getElementById("btnClose");
5 |
6 | const toggleSubNavs = (navLinkTitle, i) => {
7 | const subNavLink = navLinkTitle.nextElementSibling;
8 | !navLinkTitle.parentElement.classList.contains("open")
9 | ? (subNavLink.style.maxHeight = `${subNavLink.scrollHeight + 32}px`)
10 | : (subNavLink.style.maxHeight = "0px");
11 | navLinkTitles.forEach((_navLinkTitle, _i) => {
12 | if (i !== _i) {
13 | const subNavLink = _navLinkTitle.nextElementSibling;
14 | _navLinkTitle.parentElement.classList.remove("open");
15 | if (subNavLink) subNavLink.style.maxHeight = "0px";
16 | }
17 | });
18 | navLinkTitle.parentElement.classList.toggle("open");
19 | };
20 |
21 | navLinkTitles.forEach((navLinkTitle, i) => {
22 | navLinkTitle.addEventListener("click", () => {
23 | toggleSubNavs(navLinkTitle, i);
24 | });
25 | });
26 |
27 | btnHamburger.addEventListener("click", () => navBar.classList.add("open"));
28 | btnClose.addEventListener("click", () => navBar.classList.remove("open"));
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 3-Clause License
2 |
3 | Copyright (c) 2024, Sarthak Sachdev
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 |
8 | 1. Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | 2. Redistributions in binary form must reproduce the above copyright notice,
12 | this list of conditions and the following disclaimer in the documentation
13 | and/or other materials provided with the distribution.
14 |
15 | 3. Neither the name of the copyright holder nor the names of its
16 | contributors may be used to endorse or promote products derived from
17 | this software without specific prior written permission.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
--------------------------------------------------------------------------------
/images/client-audiophile.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/images/client-meet.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/images/client-maker.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/images/logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/images/client-databiz.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Intro Section with Dropdown Navigation
2 |
3 | ## Welcome! 👋
4 |
5 | ## Table of contents
6 |
7 | - [Overview](#overview)
8 | - [The challenge](#the-challenge)
9 | - [How to setup the project](#how-to-setup-the-project)
10 | - [Screenshot](#screenshot)
11 | - [Links](#links)
12 | - [My process](#my-process)
13 | - [Built with](#built-with)
14 | - [What I learned](#what-i-learned)
15 | - [Continued development](#continued-development)
16 | - [Useful resources](#useful-resources)
17 | - [Author](#author)
18 | - [Acknowledgments](#acknowledgments)
19 |
20 | ## Overview
21 |
22 | ### The challenge
23 |
24 | Explore our website seamlessly with the Intro Section featuring Dropdown Navigation!
25 |
26 | This component allows users to:-
27 | - View the relevant dropdown menus on desktop and mobile when interacting with the navigation links
28 | - Ensuring an optimal layout for the content depending on their device's screen size.
29 | - Users can also see hover states for all interactive elements on the page.
30 |
31 | ### How to setup the project
32 |
33 | To set up the project locally, follow these steps:
34 |
35 | 1. Clone the repository using GitHub Desktop or Git Bash:
36 | ```bash
37 | git clone https://github.com/SartHak-0-Sach/Intro-section-with-dropdown-navigation_frontend_project.git
38 | ```
39 | 2. Open the project folder in your code editor.
40 | 3. Run the project using a live server extension or deploy it using Netlify, Vercel, or another web hosting and deployment service.
41 |
42 | ### Screenshot
43 |
44 | 
45 |
46 | ### Links
47 |
48 | - Solution URL: [GitHub Repository](https://github.com/SartHak-0-Sach/Intro-section-with-dropdown-navigation_frontend_project)
49 | - Live Site URL: [Live Site](https://dropdown-nav-intro-section.netlify.app/)
50 |
51 | ## My process
52 |
53 | ### Built with
54 |
55 | - HTML5
56 | - CSS3
57 | - JavaScript
58 |
59 | You will find all the required assets in the `/design` folder. The assets are already optimized.
60 |
61 | There is also a `style-guide.md` file containing the information you'll need, such as color palette and fonts.
62 |
63 | ### What I learned
64 |
65 | This project can be of great help if one is looking for a kind of project that can help us revise a large variety of CSS and JS concepts all in one as implementing it successfully means knowing all fundamental concepts of programming well. One such example snippet is as shown below-
66 |
67 | ```js
68 | const toggleSubNavs = (navLinkTitle, i) => {
69 | const subNavLink = navLinkTitle.nextElementSibling;
70 | !navLinkTitle.parentElement.classList.contains("open")
71 | ? (subNavLink.style.maxHeight = `${subNavLink.scrollHeight + 32}px`)
72 | : (subNavLink.style.maxHeight = "0px");
73 | navLinkTitles.forEach((_navLinkTitle, _i) => {
74 | if (i !== _i) {
75 | const subNavLink = _navLinkTitle.nextElementSibling;
76 | _navLinkTitle.parentElement.classList.remove("open");
77 | if (subNavLink) subNavLink.style.maxHeight = "0px";
78 | }
79 | });
80 | navLinkTitle.parentElement.classList.toggle("open");
81 | };
82 |
83 | navLinkTitles.forEach((navLinkTitle, i) => {
84 | navLinkTitle.addEventListener("click", () => {
85 | toggleSubNavs(navLinkTitle, i);
86 | });
87 | });
88 | ```
89 |
90 | ### Continued development
91 |
92 | The continuously learning journey of a programmer never ends. This project made me realize that there are many concepts that I need to work upon including fundamentals like flex-box and its properties, to more complex concepts like working with fetch and async await in JavaScript. These areas are some that I think I need to work more upon in the upcoming future as they highlight some of the most significant regions of web development that are important for every developer to know of.
93 |
94 | These key points mentioned here will help me grow accountable and consistent towards improving at writing good quality code and be a successful full stack developer one day.
95 |
96 | ### Useful resources
97 |
98 | - [Harkirat Singh course notes](https://github.com/SartHak-0-Sach/harkirat-singh-course_code_and_notes) - I have added notes of all lectures along with code and lecture insights of all weeks along with bonus lectures to help you all as much as I can.
99 | - [My development code and notes](https://github.com/SartHak-0-Sach/cwh-web-dev-playlist_code_and_notes) - These are my notes that I made while working on my development skills in initial days and did these courses. Make sure to star the repository if you like it.✨💫
100 | - [MDN documentation hover state for CSS](https://developer.mozilla.org/en-US/docs/Web/CSS/:hover) - This is an amazing article which helped me finally understand hover states. I'd recommend it to anyone still learning this concept.
101 |
102 | ## Author
103 |
104 | Sarthak Sachdev
105 | - Website - [Sarthak Sachdev](https://itsmesarthak.netlify.app/)
106 | - LeetCode - [@sarthak_sachdev](https://leetcode.com/u/sarthak_sachdev/)
107 | - Twitter - [@sarthak_sach69](https://www.twitter.com/sarthak_sach69)
108 |
109 | ## Acknowledgments
110 |
111 | I feel like the solutions provided on the website and the continuous doubt solving by industry experts on discord for free is something that is unmatched by anyone else and need to be acknowledged for their efforts in improving me as a developer by suggesting the best practices in your respective tech stack.
112 |
113 | ## Got feedback for me?
114 |
115 | I love receiving feedback! I am always looking to improve my code and take up new innovative ideas to work upon. So if you have anything you'd like to mention, please email 'hi' at saarsaach30[at]gmail[dot]com.
116 |
117 | If you liked this project make sure to spread the word and share it with all your friends.
118 |
119 | **Happy coding!** ☺️🚀
120 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |