diff --git a/src/app/components/faq/faq.component.css b/src/app/components/faq/faq.component.css index 82e0b73..9605dc2 100644 --- a/src/app/components/faq/faq.component.css +++ b/src/app/components/faq/faq.component.css @@ -37,60 +37,168 @@ body { scrollbar-width: thin; /* Makes the scrollbar thin */ scrollbar-color: #ff66b2 #f0f0f0; /* Color of the thumb and track */ } + +.faq { + padding: 4rem 2rem; + margin: auto; + margin-top: 100px; + max-width: 800px; -.faq{ - width: 800px; - margin-top: 5rem !important; } -/*start styles*/ -.accordion { - display: flex; - flex-direction: column; - gap: 10px; - width: 100%; + +.faq h1 { + font-size: 2.5rem; + font-weight: 600; + color: #2c3e50; + text-align: center; + margin-bottom: 2rem; + padding: 1rem 0; + text-transform: uppercase; + letter-spacing: 1px; +} + +.faq-search { + width: 100%; + padding: 0.5rem; + border: 1px solid #ccc; + border-radius: 5px; + margin-bottom: 1rem; + font-size: 1rem; +} + +.toggle-all { + background-color: #4a4a4a; + color: white; + border: none; + padding: 0.5rem 1rem; + cursor: pointer; + margin-bottom: 1rem; + border-radius: 5px; + transition: background-color 0.3s ease; +} + +.toggle-all:hover { + background-color: #383838; + /* Darken on hover */ } .accordion__item { - border: 2px solid #cad8df; - border-radius: 10px; - overflow: hidden; + margin-bottom: 1.5rem; + border-radius: 5px; + overflow: hidden; + border: 1px solid #e0e0e0; + transition: box-shadow 0.3s ease; + border-radius: 25px; +} + +.accordion__item:hover { + box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); } .accordion__header { -padding: 20px 25px; - font-weight: 600; - cursor: pointer; - position: relative; + background-color: #181818; + color: #fff; + font-size: 1.25rem; + font-weight: 600; + padding: 2rem 2.5rem; + cursor: pointer; + display: flex; + justify-content: space-between; + align-items: center; + transition: background-color 0.3s ease; +} + +.question-icon { + margin-right: 10px; + /* Space between icon and question */ + font-weight: bold; + color: #f1c40f; + /* Color for question icon */ +} + +.accordion__header:hover { + background-color: #121212; +} + +.accordion__content { + max-height: 0; + overflow: hidden; + background-color: #f1f1f1; + transition: max-height 0.3s ease, padding 0.3s ease; + padding: 0 1.5rem; +} + +.accordion__content p { + padding: 1rem 0; + margin: 0; +} + +.feedback { + margin-top: 1rem; + /* Space between answer and feedback */ } -.accordion__header::after { - content: ''; - background: url(https://www.svgrepo.com/show/357035/angle-down.svg) no-repeat center; - width: 20px; - height: 20px; - transition: .4s; - display: inline-block; - position: absolute; - right: 20px; - top: 20px; - z-index: 1; +.feedback span { + font-size: 0.9rem; + /* Smaller font for feedback text */ } -.accordion__header.active { - background: #e5f3fa; +.feedback i { + cursor: pointer; + margin-left: 0.5rem; + /* Space between icons */ + color: #4a4a4a; + transition: color 0.3s; } -.accordion__header.active::after { - transform: rotateX(180deg); +.feedback i:hover { + color: #2c3e50; + /* Change color on hover */ } -.accordion__item .accordion__content { - padding: 0; - max-height: 0; - transition: .5s; - overflow: hidden; +.accordion__item.active .accordion__content { + max-height: none; + padding: 1rem 1.5rem; } -p{ - padding: 25px; +.arrow { + transition: transform 0.3s ease; } + +/* Responsive design */ +@media (max-width: 600px) { + .faq { + padding: 2rem 1rem; + } + + .faq h1 { + font-size: 2rem; + } + .accordion__item.active .accordion__content { + max-height: none; + padding: 1rem 1.5rem; + } + .accordion__header { + font-size: 1.1rem; + } + + .faq-search { + font-size: 0.9rem; + /* Adjust font size for smaller screens */ + } + + .toggle-all { + padding: 0.5rem; + /* Adjust padding */ + } +} + +.arrow { + transition: transform 0.3s ease; + /* Smooth transition for rotation */ +} + +.arrow.active { + transform: rotate(180deg); + /* Rotate the arrow when the FAQ is open */ +} \ No newline at end of file diff --git a/src/app/components/faq/faq.component.html b/src/app/components/faq/faq.component.html index c1390bc..e70f023 100644 --- a/src/app/components/faq/faq.component.html +++ b/src/app/components/faq/faq.component.html @@ -1,162 +1,23 @@ - - - - - - - GraphExplorer Pro - FAQ - - - - - - - - -
-

Frequently Asked Questions

-
-
-
What is GraphExplorer Pro?
-
-

GraphExplorer Pro is an interactive tool designed to help users explore, learn, and visualize different graph algorithms and their real-world applications.

-
-
- -
-
What graph algorithms are included?
-
-

GraphExplorer Pro covers a wide range of graph algorithms, including Depth-First Search (DFS), Breadth-First Search (BFS), Dijkstra's algorithm, and more.

-
-
- -
-
How can I use the Graph Visualizer?
-
-

The Graph Visualizer allows users to experiment with different graph structures and watch algorithms traverse them step by step, providing an in-depth understanding of the processes involved.

-
-
- -
-
What are the different graph types I can explore?
-
-

GraphExplorer Pro allows you to explore directed graphs, undirected graphs, weighted graphs, trees, and directed acyclic graphs (DAGs).

-
-
- -
-
Is GraphExplorer Pro suitable for beginners?
-
-

Yes! GraphExplorer Pro is designed for learners of all levels, offering interactive visualizations and detailed explanations to help beginners understand the basics of graph theory.

-
-
- -
-
Can I save my visualizations?
-
-

Yes, GraphExplorer Pro provides an option to save your graph visualizations so you can revisit and analyze them later.

-
-
- -
-
Does GraphExplorer Pro support weighted graphs?
-
-

Yes, GraphExplorer Pro supports weighted graphs, and you can visualize how different algorithms handle weights in edges.

-
-
- -
-
What platforms is GraphExplorer Pro available on?
-
-

GraphExplorer Pro is a web-based tool that works on all modern browsers, and it is compatible with desktop, tablet, and mobile devices.

-
-
- -
-
How often are new features added?
-
-

We frequently update GraphExplorer Pro with new features and improvements based on user feedback. Stay tuned for updates!

-
-
- -
-
Do I need to create an account to use GraphExplorer Pro?
-
-

No, you can use GraphExplorer Pro without creating an account. However, creating an account allows you to save your progress and visualizations.

+ +
+

Frequently Asked Questions

+ + +
+
+
+ ? + {{ faq.question }} + +
+
+

{{ faq.answer }}

+
-
- - - +
+
\ No newline at end of file diff --git a/src/app/components/faq/faq.component.ts b/src/app/components/faq/faq.component.ts index b29aa3d..9a24f49 100644 --- a/src/app/components/faq/faq.component.ts +++ b/src/app/components/faq/faq.component.ts @@ -1,62 +1,136 @@ import { Component, AfterViewInit, OnInit } from '@angular/core'; +import { CommonModule } from '@angular/common'; // Import CommonModule import { NavbarComponent } from '../navbar/navbar.component'; import { Title } from '@angular/platform-browser'; import { AuthService } from '../../services/auth.service'; +interface FAQ { + id: number; + question: string; + answer: string; + isOpen: boolean; + contentHeight?: string; +} + @Component({ selector: 'app-faq', standalone: true, - imports: [NavbarComponent], + imports: [NavbarComponent, CommonModule], templateUrl: './faq.component.html', - styleUrls: ['./faq.component.css'] + styleUrls: ['./faq.component.css'], }) -export class FaqComponent implements AfterViewInit { +export class FaqComponent implements OnInit, AfterViewInit { + constructor(private authService: AuthService, private titleService: Title) {} - constructor(private authService: AuthService,private titleService: Title) {} + faqs: FAQ[] = [ + { + id: 1, + question: 'What is GraphExplorer Pro?', + answer: + 'GraphExplorer Pro is an interactive tool designed to help users explore, learn, and visualize different graph algorithms and their real-world applications.', + isOpen: false, + }, + { + id: 2, + question: 'What graph algorithms are included?', + answer: + "GraphExplorer Pro covers a wide range of graph algorithms, including Depth-First Search (DFS), Breadth-First Search (BFS), Dijkstra's algorithm, and more.", + isOpen: false, + }, + { + id: 3, + question: 'How can I use the Graph Visualizer?', + answer: + 'The Graph Visualizer allows users to experiment with different graph structures and watch algorithms traverse them step by step, providing an in-depth understanding of the processes involved.', + isOpen: false, + }, + { + id: 4, + question: 'What are the different graph types I can explore?', + answer: + 'GraphExplorer Pro allows you to explore directed graphs, undirected graphs, weighted graphs, trees, and directed acyclic graphs (DAGs).', + isOpen: false, + }, + { + id: 5, + question: 'Is GraphExplorer Pro suitable for beginners?', + answer: + 'Yes! GraphExplorer Pro is designed for learners of all levels, offering interactive visualizations and detailed explanations to help beginners understand the basics of graph theory.', + isOpen: false, + }, + { + id: 6, + question: 'Can I save my visualizations?', + answer: + 'Yes, GraphExplorer Pro provides an option to save your graph visualizations so you can revisit and analyze them later.', + isOpen: false, + }, + { + id: 7, + question: 'Does GraphExplorer Pro support weighted graphs?', + answer: + 'Yes, GraphExplorer Pro supports weighted graphs, and you can visualize how different algorithms handle weights in edges.', + isOpen: false, + }, + { + id: 8, + question: 'What platforms is GraphExplorer Pro available on?', + answer: + 'GraphExplorer Pro is a web-based tool that works on all modern browsers, and it is compatible with desktop, tablet, and mobile devices.', + isOpen: false, + }, + { + id: 9, + question: 'How often are new features added?', + answer: + 'We frequently update GraphExplorer Pro with new features and improvements based on user feedback. Stay tuned for updates!', + isOpen: false, + }, + { + id: 10, + question: 'Do I need to create an account to use GraphExplorer Pro?', + answer: + 'No, you can use GraphExplorer Pro without creating an account. However, creating an account allows you to save your progress and visualizations.', + isOpen: false, + }, + ]; + filteredFaqs: FAQ[] = [...this.faqs]; // Start with all FAQs - ngOnInit(): void { - this.titleService.setTitle('GraphExplorer Pro | FAQ'); + filterFAQs(event: any): void { + const query = event.target.value.toLowerCase(); + this.filteredFaqs = this.faqs.filter( + (faq) => + faq.question.toLowerCase().includes(query) || + faq.answer.toLowerCase().includes(query) + ); } + toggleAll(): void { + const isAnyOpen = this.faqs.some((faq) => faq.isOpen); + this.faqs.forEach((faq) => { + faq.isOpen = !isAnyOpen; // Toggle based on current state + }); + } + + ngOnInit(): void { + document.title = 'GraphExplorer Pro | FAQ'; + } ngAfterViewInit() { - // const faqItems = document.querySelectorAll('.faq-item'); - // faqItems.forEach((item) => { - // const question = item.querySelector('.faq-question'); - // if (question) { - // question.addEventListener('click', () => { - // item.classList.toggle('open'); - // const answer = item.querySelector('.faq-answer'); - // if (answer) { - // if (item.classList.contains('open')) { - // answer.style.maxHeight = `${answer.scrollHeight}px`; - // } else { - // answer.style.maxHeight = '0'; - // } - // } - // }); - // } - // }); - - - - - document.addEventListener('DOMContentLoaded', () => { - const togglers = document.querySelectorAll('[data-toggle]'); - - togglers.forEach((btn) => { - btn.addEventListener('click', (e:any) => { - const selector = e.currentTarget?.dataset.toggle - const block = document.querySelector(`${selector}`) as HTMLElement; - if (e.currentTarget?.classList.contains('active')) { - block.style.maxHeight = ''; - } else { - block.style.maxHeight = block.scrollHeight + 'px'; - } - - e.currentTarget?.classList.toggle('active') - }) - }) - }) + this.faqs.forEach((faq) => { + const element = document.getElementById(`faq${faq.id}`); + if (element) { + faq.contentHeight = `${element.scrollHeight + 20}px`; + } else { + faq.contentHeight = '0'; + } + }); + } + + toggle(id: number): void { + const faq = this.faqs.find((f) => f.id === id); + if (faq) { + faq.isOpen = !faq.isOpen; // Toggle the isOpen state + } } }