├── .gitignore ├── LICENSE ├── README.md ├── assets ├── fonts │ ├── OFL.txt │ ├── README.txt │ ├── WorkSans-Italic-VariableFont_wght.ttf │ ├── WorkSans-VariableFont_wght.ttf │ └── static │ │ ├── WorkSans-Bold.ttf │ │ ├── WorkSans-Regular.ttf │ │ └── WorkSans-SemiBold.ttf └── images │ ├── background-pattern-desktop.svg │ ├── background-pattern-mobile.svg │ ├── favicon-32x32.png │ ├── icon-minus.svg │ ├── icon-plus.svg │ └── icon-star.svg ├── design ├── active-states.jpg ├── desktop-design.jpg ├── desktop-preview.jpg └── mobile-design.jpg ├── index.html ├── script.js ├── style-guide.md └── style.css /.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 -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Sarthak Sachdev 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FAQ Accordion 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 | The challenge is to create an FAQ Accordion project showcasing a component of a webpage for users to read FAQs regarding a known website called Frontend Mentor. 25 | 26 | Users should be able to- 27 | - Hide/show the answer to a question when the question is clicked. 28 | - Navigate the questions and hide/show answers using keyboard navigation alone. 29 | - Additionally, users should be able to view the optimal layout for the interface depending on their device's screen size. 30 | - See hover and focus states for all interactive elements on the page. 31 | 32 | ### How to setup the project 33 | 34 | To set up the project locally, follow these steps: 35 | 36 | 1. Clone the repository using GitHub Desktop or Git Bash: 37 | ```bash 38 | git clone https://github.com/SartHak-0-Sach/FAQ-accordion_frontend_project.git 39 | ``` 40 | 2. Open the project folder in your code editor. 41 | 3. Run the project using a live server extension or deploy it using Netlify, Vercel, or another web hosting and deployment service. 42 | 43 | ### Screenshot 44 | 45 |  46 | 47 | ### Links 48 | 49 | - Solution URL: [GitHub Repository](https://github.com/SartHak-0-Sach/FAQ-accordion_frontend_project) 50 | - Live Site URL: [Live Site](https://faq-accordion-app-frontend.netlify.app/) 51 | 52 | ## My process 53 | 54 | ### Built with 55 | 56 | - HTML5 57 | - CSS3 58 | - JavaScript 59 | 60 | You will find all the required assets in the `/images` folder. The assets are already optimized. 61 | 62 | There is also a `style-guide.md` file containing the information you'll need, such as color palette and fonts. 63 | 64 | ### What I learned 65 | 66 | Making this project has been a great learning journey as this was among some of my first projects and I had to really invest time to learn JavaScript event listeners and how to work with them. In the end I am proud that I was able to successfully execute this project and code the part mentioned above as shown- 67 | 68 | ```js 69 | for (let i = 0; i < buttons.length; i++) { 70 | let currentButton = buttons[i]; 71 | let currentAnswer = answers[i]; 72 | let plusIcon = currentButton.children[0]; 73 | let minusIcon = currentButton.children[1]; 74 | 75 | currentButton.addEventListener('click', e => { 76 | plusIcon.style.display === 'none' ? closeAnswer(plusIcon, minusIcon, currentAnswer) : openAnswer(plusIcon, minusIcon, currentAnswer); 77 | }); 78 | } 79 | 80 | function openAnswer(plusIcon, minusIcon, currentAnswer) { 81 | plusIcon.style.display = 'none'; 82 | minusIcon.style.display = 'block'; 83 | currentAnswer.style.display = 'block'; 84 | } 85 | 86 | function closeAnswer(plusIcon, minusIcon, currentAnswer) { 87 | plusIcon.style.display = 'block'; 88 | minusIcon.style.display = 'none'; 89 | currentAnswer.style.display = 'none'; 90 | } 91 | ``` 92 | 93 | ### Continued development 94 | 95 | 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. 96 | 97 | 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. 98 | 99 | ### Useful resources 100 | 101 | - [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. 102 | - [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.✨💫 103 | - [mdn documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function) - This is an amazing article which helped me finally understand promises, async and await syntax. I'd recommend it to anyone still learning this concept. 104 | 105 | ## Author 106 | 107 | Sarthak Sachdev 108 | - Website - [Sarthak Sachdev](https://itsmesarthak.netlify.app/) 109 | - LeetCode - [@sarthak_sachdev](https://leetcode.com/u/sarthak_sachdev/) 110 | - Twitter - [@sarthak_sach69](https://www.twitter.com/sarthak_sach69) 111 | 112 | ## Acknowledgments 113 | 114 | 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. 115 | 116 | ## Got feedback for me? 117 | 118 | 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. 119 | 120 | If you found this project helpful, consider sharing it with others to spread the knowledge! 121 | 122 | **Happy coding!** 📚🚀 -------------------------------------------------------------------------------- /assets/fonts/OFL.txt: -------------------------------------------------------------------------------- 1 | Copyright 2019 The Work Sans Project Authors (https://github.com/weiweihuanghuang/Work-Sans) 2 | 3 | This Font Software is licensed under the SIL Open Font License, Version 1.1. 4 | This license is copied below, and is also available with a FAQ at: 5 | http://scripts.sil.org/OFL 6 | 7 | 8 | ----------------------------------------------------------- 9 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 10 | ----------------------------------------------------------- 11 | 12 | PREAMBLE 13 | The goals of the Open Font License (OFL) are to stimulate worldwide 14 | development of collaborative font projects, to support the font creation 15 | efforts of academic and linguistic communities, and to provide a free and 16 | open framework in which fonts may be shared and improved in partnership 17 | with others. 18 | 19 | The OFL allows the licensed fonts to be used, studied, modified and 20 | redistributed freely as long as they are not sold by themselves. The 21 | fonts, including any derivative works, can be bundled, embedded, 22 | redistributed and/or sold with any software provided that any reserved 23 | names are not used by derivative works. The fonts and derivatives, 24 | however, cannot be released under any other type of license. The 25 | requirement for fonts to remain under this license does not apply 26 | to any document created using the fonts or their derivatives. 27 | 28 | DEFINITIONS 29 | "Font Software" refers to the set of files released by the Copyright 30 | Holder(s) under this license and clearly marked as such. This may 31 | include source files, build scripts and documentation. 32 | 33 | "Reserved Font Name" refers to any names specified as such after the 34 | copyright statement(s). 35 | 36 | "Original Version" refers to the collection of Font Software components as 37 | distributed by the Copyright Holder(s). 38 | 39 | "Modified Version" refers to any derivative made by adding to, deleting, 40 | or substituting -- in part or in whole -- any of the components of the 41 | Original Version, by changing formats or by porting the Font Software to a 42 | new environment. 43 | 44 | "Author" refers to any designer, engineer, programmer, technical 45 | writer or other person who contributed to the Font Software. 46 | 47 | PERMISSION & CONDITIONS 48 | Permission is hereby granted, free of charge, to any person obtaining 49 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 50 | redistribute, and sell modified and unmodified copies of the Font 51 | Software, subject to the following conditions: 52 | 53 | 1) Neither the Font Software nor any of its individual components, 54 | in Original or Modified Versions, may be sold by itself. 55 | 56 | 2) Original or Modified Versions of the Font Software may be bundled, 57 | redistributed and/or sold with any software, provided that each copy 58 | contains the above copyright notice and this license. These can be 59 | included either as stand-alone text files, human-readable headers or 60 | in the appropriate machine-readable metadata fields within text or 61 | binary files as long as those fields can be easily viewed by the user. 62 | 63 | 3) No Modified Version of the Font Software may use the Reserved Font 64 | Name(s) unless explicit written permission is granted by the corresponding 65 | Copyright Holder. This restriction only applies to the primary font name as 66 | presented to the users. 67 | 68 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 69 | Software shall not be used to promote, endorse or advertise any 70 | Modified Version, except to acknowledge the contribution(s) of the 71 | Copyright Holder(s) and the Author(s) or with their explicit written 72 | permission. 73 | 74 | 5) The Font Software, modified or unmodified, in part or in whole, 75 | must be distributed entirely under this license, and must not be 76 | distributed under any other license. The requirement for fonts to 77 | remain under this license does not apply to any document created 78 | using the Font Software. 79 | 80 | TERMINATION 81 | This license becomes null and void if any of the above conditions are 82 | not met. 83 | 84 | DISCLAIMER 85 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 86 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 87 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 88 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 89 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 90 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 91 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 92 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 93 | OTHER DEALINGS IN THE FONT SOFTWARE. 94 | -------------------------------------------------------------------------------- /assets/fonts/README.txt: -------------------------------------------------------------------------------- 1 | Work Sans Variable Font 2 | ======================= 3 | 4 | This download contains Work Sans as both variable fonts and static fonts. 5 | 6 | Work Sans is a variable font with this axis: 7 | wght 8 | 9 | This means all the styles are contained in these files: 10 | WorkSans-VariableFont_wght.ttf 11 | WorkSans-Italic-VariableFont_wght.ttf 12 | 13 | If your app fully supports variable fonts, you can now pick intermediate styles 14 | that aren’t available as static fonts. Not all apps support variable fonts, and 15 | in those cases you can use the static font files for Work Sans: 16 | static/WorkSans-Thin.ttf 17 | static/WorkSans-ExtraLight.ttf 18 | static/WorkSans-Light.ttf 19 | static/WorkSans-Regular.ttf 20 | static/WorkSans-Medium.ttf 21 | static/WorkSans-SemiBold.ttf 22 | static/WorkSans-Bold.ttf 23 | static/WorkSans-ExtraBold.ttf 24 | static/WorkSans-Black.ttf 25 | static/WorkSans-ThinItalic.ttf 26 | static/WorkSans-ExtraLightItalic.ttf 27 | static/WorkSans-LightItalic.ttf 28 | static/WorkSans-Italic.ttf 29 | static/WorkSans-MediumItalic.ttf 30 | static/WorkSans-SemiBoldItalic.ttf 31 | static/WorkSans-BoldItalic.ttf 32 | static/WorkSans-ExtraBoldItalic.ttf 33 | static/WorkSans-BlackItalic.ttf 34 | 35 | Get started 36 | ----------- 37 | 38 | 1. Install the font files you want to use 39 | 40 | 2. Use your app's font picker to view the font family and all the 41 | available styles 42 | 43 | Learn more about variable fonts 44 | ------------------------------- 45 | 46 | https://developers.google.com/web/fundamentals/design-and-ux/typography/variable-fonts 47 | https://variablefonts.typenetwork.com 48 | https://medium.com/variable-fonts 49 | 50 | In desktop apps 51 | 52 | https://theblog.adobe.com/can-variable-fonts-illustrator-cc 53 | https://helpx.adobe.com/nz/photoshop/using/fonts.html#variable_fonts 54 | 55 | Online 56 | 57 | https://developers.google.com/fonts/docs/getting_started 58 | https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Fonts/Variable_Fonts_Guide 59 | https://developer.microsoft.com/en-us/microsoft-edge/testdrive/demos/variable-fonts 60 | 61 | Installing fonts 62 | 63 | MacOS: https://support.apple.com/en-us/HT201749 64 | Linux: https://www.google.com/search?q=how+to+install+a+font+on+gnu%2Blinux 65 | Windows: https://support.microsoft.com/en-us/help/314960/how-to-install-or-remove-a-font-in-windows 66 | 67 | Android Apps 68 | 69 | https://developers.google.com/fonts/docs/android 70 | https://developer.android.com/guide/topics/ui/look-and-feel/downloadable-fonts 71 | 72 | License 73 | ------- 74 | Please read the full license text (OFL.txt) to understand the permissions, 75 | restrictions and requirements for usage, redistribution, and modification. 76 | 77 | You can use them in your products & projects – print or digital, 78 | commercial or otherwise. 79 | 80 | This isn't legal advice, please consider consulting a lawyer and see the full 81 | license for all details. 82 | -------------------------------------------------------------------------------- /assets/fonts/WorkSans-Italic-VariableFont_wght.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/all-my-frontend-mini-projects/FAQ-accordion_frontend_project/fa54d37dcdfc842dc85f600186760891d0a3279b/assets/fonts/WorkSans-Italic-VariableFont_wght.ttf -------------------------------------------------------------------------------- /assets/fonts/WorkSans-VariableFont_wght.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/all-my-frontend-mini-projects/FAQ-accordion_frontend_project/fa54d37dcdfc842dc85f600186760891d0a3279b/assets/fonts/WorkSans-VariableFont_wght.ttf -------------------------------------------------------------------------------- /assets/fonts/static/WorkSans-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/all-my-frontend-mini-projects/FAQ-accordion_frontend_project/fa54d37dcdfc842dc85f600186760891d0a3279b/assets/fonts/static/WorkSans-Bold.ttf -------------------------------------------------------------------------------- /assets/fonts/static/WorkSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/all-my-frontend-mini-projects/FAQ-accordion_frontend_project/fa54d37dcdfc842dc85f600186760891d0a3279b/assets/fonts/static/WorkSans-Regular.ttf -------------------------------------------------------------------------------- /assets/fonts/static/WorkSans-SemiBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/all-my-frontend-mini-projects/FAQ-accordion_frontend_project/fa54d37dcdfc842dc85f600186760891d0a3279b/assets/fonts/static/WorkSans-SemiBold.ttf -------------------------------------------------------------------------------- /assets/images/background-pattern-desktop.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/images/background-pattern-mobile.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/images/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/all-my-frontend-mini-projects/FAQ-accordion_frontend_project/fa54d37dcdfc842dc85f600186760891d0a3279b/assets/images/favicon-32x32.png -------------------------------------------------------------------------------- /assets/images/icon-minus.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/images/icon-plus.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/images/icon-star.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /design/active-states.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/all-my-frontend-mini-projects/FAQ-accordion_frontend_project/fa54d37dcdfc842dc85f600186760891d0a3279b/design/active-states.jpg -------------------------------------------------------------------------------- /design/desktop-design.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/all-my-frontend-mini-projects/FAQ-accordion_frontend_project/fa54d37dcdfc842dc85f600186760891d0a3279b/design/desktop-design.jpg -------------------------------------------------------------------------------- /design/desktop-preview.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/all-my-frontend-mini-projects/FAQ-accordion_frontend_project/fa54d37dcdfc842dc85f600186760891d0a3279b/design/desktop-preview.jpg -------------------------------------------------------------------------------- /design/mobile-design.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/all-my-frontend-mini-projects/FAQ-accordion_frontend_project/fa54d37dcdfc842dc85f600186760891d0a3279b/design/mobile-design.jpg -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 |Frontend Mentor offers realistic coding challenges to help developers improve their frontend coding skills with projects in HTML, CSS, and JavaScript. It's suitable for all levels and ideal for portfolio building.
31 |Yes, Frontend Mentor offers both free and premium coding challenges, with the free option providing access to a range of projects suitable for all skill levels.
43 |Yes, you can use projects completed on Frontend Mentor in your portfolio. It's an excellent way to showcase your skills to potential employers!
55 |The best place to get help is inside Frontend Mentor's Discord community. There's a help channel where you can ask questions and seek support from other community members.
67 |