Skip to content

Commit

Permalink
Merge pull request #11 from shubhagarwal1/faq
Browse files Browse the repository at this point in the history
FEATURE: Add navbar and faq page
  • Loading branch information
jahnvisahni31 authored Oct 2, 2024
2 parents b3712ae + 3f7cb9e commit d40f5f0
Show file tree
Hide file tree
Showing 4 changed files with 177 additions and 39 deletions.
93 changes: 93 additions & 0 deletions app/faq/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
"use client";
import React, { useState } from "react";

const faqs = [
{
question: "What is DesignDeck?",
answer:
"DesignDeck is a web-based collaborative design tool, similar to Figma, built using Next.js, TypeScript, Tailwind CSS, and LiveBlocks API. It allows teams to seamlessly collaborate on designing interfaces in real-time.",
},
{
question: "How do I get started with DesignDeck?",
answer:
"To get started, clone the repository from GitHub, install the dependencies, and run the project locally using npm. The full guide is available in the README.md file.",
},
{
question: "What features does DesignDeck offer?",
answer:
"DesignDeck offers live collaboration, shape manipulation, free drawing, text addition, export to PDF, and many more features to help you design interfaces collaboratively.",
},
{
question: "How can I contribute to DesignDeck?",
answer:
"You can contribute by forking the repository, creating a new branch, making your changes, and submitting a pull request. Contributions are always welcome!",
},
{
question: "Is DesignDeck open source?",
answer:
"Yes, DesignDeck is an open-source project, and we encourage contributions from the community.",
},
{
question: "Does DesignDeck support real-time collaboration?",
answer:
"Yes, with the LiveBlocks API integrated into DesignDeck, multiple users can collaborate in real-time. You can see live updates of cursor positions and design changes as they happen.",
},
{
question: "What technologies power DesignDeck?",
answer:
"DesignDeck is built using Next.js, TypeScript, Tailwind CSS, and LiveBlocks API for real-time collaboration, along with Fabric.js for manipulating graphics and interactive content.",
},
{
question: "How can I export my designs in DesignDeck?",
answer:
"DesignDeck allows you to export designs to PDF format. Simply select the elements you want to export and use the export option to generate a downloadable PDF.",
},
{
question: "Are there keyboard shortcuts available in DesignDeck?",
answer:
"Currently, DesignDeck does not supports keyboard shortcuts,the feature is under development, once prepare user will be abel to do faster design operations, such as Undo (Ctrl+Z), Redo (Ctrl+Y), and copy-pasting elements.",
},
];

const FAQ = () => {
const [activeIndex, setActiveIndex] = useState<number | null>(null);

const toggleFAQ = (index: number) => {
setActiveIndex(index === activeIndex ? null : index);
};

return (
<div className="container mx-auto p-6 min-h-screen h-screen overflow-y-auto">
<h1 className="text-4xl font-bold mb-6 text-center text-white">
Frequently Asked Questions
</h1>
<div className="space-y-4 max-w-2xl mx-auto">
{faqs.map((faq, index) => (
<div
key={index}
className="border-b border-gray-700 py-4 cursor-pointer"
onClick={() => toggleFAQ(index)}
>
<div className="flex justify-between items-center">
<h2
className={`font-semibold text-lg ${
activeIndex === index ? "text-white" : "text-gray-300"
}`}
>
{faq.question}
</h2>
<span className="text-gray-400">
{activeIndex === index ? "-" : "+"}
</span>
</div>
{activeIndex === index && (
<p className="mt-2 text-gray-300">{faq.answer}</p>
)}
</div>
))}
</div>
</div>
);
};

export default FAQ;
3 changes: 3 additions & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { Metadata } from "next";
import { Work_Sans } from "next/font/google";
import "./globals.css";
import { Room } from "./Room";
import NavBar from "../components/navbar/navbar";

const workSans = Work_Sans({
subsets: ["latin"],
Expand All @@ -22,6 +23,8 @@ export default function RootLayout({
return (
<html lang="en">
<body className={`${workSans.className} bg-primary-grey-200`}>
{/* Add the NavBar here */}
<NavBar />
<Room>{children}</Room>
</body>
</html>
Expand Down
78 changes: 39 additions & 39 deletions components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,35 +24,46 @@ function Navbar({

return (
<nav className="flex select-none items-center justify-between gap-4 bg-primary-black px-5 text-white">
<Image src="/assets/logo.png" alt="Logo" width={66} height={26} />

<ul className="flex">
{/* Renders nav elements */}
{navElements.map((item: ActiveElement | any) => (
<li
key={item.name}
onClick={() => {
if (Array.isArray(item.value)) return; // Prevents selection of shapes menu
handleActiveElement(item);
}}
className={`group px-2.5 py-5 flex justify-center items-center
<div className="flex-grow flex justify-center">
<ul className="flex">
{/* Renders nav elements */}
{navElements.map((item: ActiveElement | any) => (
<li
key={item.name}
onClick={() => {
if (Array.isArray(item.value)) return; // Prevents selection of shapes menu
handleActiveElement(item);
}}
className={`group px-2.5 py-5 flex justify-center items-center
${
isActive(item.value)
? "bg-primary-green"
: "hover:bg-primary-grey-200"
}
`}
>
{Array.isArray(item.value) ? ( // Renders shapes menu
<ShapesMenu
item={item}
activeElement={activeElement}
imageInputRef={imageInputRef}
handleActiveElement={handleActiveElement}
handleImageUpload={handleImageUpload}
/>
) : item.value === "comments" ? ( // Renders comments cursor
<NewThread>
>
{Array.isArray(item.value) ? ( // Renders shapes menu
<ShapesMenu
item={item}
activeElement={activeElement}
imageInputRef={imageInputRef}
handleActiveElement={handleActiveElement}
handleImageUpload={handleImageUpload}
/>
) : item.value === "comments" ? ( // Renders comments cursor
<NewThread>
<Button className="relative w-5 h-5 object-contain">
<Image
src={item.icon}
alt={item.name}
fill
sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 20vw"
className={isActive(item.value) ? "invert" : ""}
/>
</Button>
</NewThread>
) : (
// Renders other nav elements
<Button className="relative w-5 h-5 object-contain">
<Image
src={item.icon}
Expand All @@ -62,22 +73,11 @@ function Navbar({
className={isActive(item.value) ? "invert" : ""}
/>
</Button>
</NewThread>
) : (
// Renders other nav elements
<Button className="relative w-5 h-5 object-contain">
<Image
src={item.icon}
alt={item.name}
fill
sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 20vw"
className={isActive(item.value) ? "invert" : ""}
/>
</Button>
)}
</li>
))}
</ul>
)}
</li>
))}
</ul>
</div>

<ActiveUsers />
</nav>
Expand Down
42 changes: 42 additions & 0 deletions components/navbar/navbar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"use client";

import Image from "next/image";
import Link from "next/link";
import React from "react";

const NavBar = () => {
return (
<nav className="bg-gray-800 p-4">
<div className="container mx-auto flex justify-between items-center">
{/* Logo with larger size */}
<Link href="/">
<Image
src="/assets/logo.png"
alt="Logo"
width={100}
height={40}
className="cursor-pointer"
/>
</Link>

{/* Navigation Links */}
<div className="flex space-x-4 text-white">
<Link
href="/"
className="hover:underline hover:text-gray-300 transition duration-300 ease-in-out"
>
Home
</Link>
<Link
href="/faq"
className="hover:underline hover:text-gray-300 transition duration-300 ease-in-out"
>
FAQ
</Link>
</div>
</div>
</nav>
);
};

export default NavBar;

0 comments on commit d40f5f0

Please sign in to comment.