From 94ebf2b9fa035d16006ff12733989165fdf26fd2 Mon Sep 17 00:00:00 2001 From: Aditya Tulsiyan Date: Wed, 5 Jul 2023 21:39:20 +0530 Subject: [PATCH 1/3] Added options button on Docs --- app/docs/page.tsx | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/app/docs/page.tsx b/app/docs/page.tsx index 2e687a46f..6990ad1ba 100644 --- a/app/docs/page.tsx +++ b/app/docs/page.tsx @@ -1,6 +1,6 @@ "use client"; import { GitBranch, FileText, UploadCloud } from "react-feather"; -import { useEffect, ReactNode } from "react"; +import { useEffect, ReactNode, useState } from "react"; import SyntaxHighlighter from "react-syntax-highlighter"; import { a11yDark } from "react-syntax-highlighter/dist/esm/styles/hljs"; import { Navbar, Footer } from "@/components"; @@ -77,7 +77,7 @@ const option1Steps = [ const option2Steps = [ { icon: , - text: "OR, If you want to run it locally then follow these steps", + text: "If you want to run it locally then follow these steps", code: "" }, { @@ -181,22 +181,19 @@ function Step({ icon, text, code, image }: StepProps): JSX.Element { ); } -function AddYourProjectsGuide(): any { +function AddYourProjectsGuide(): JSX.Element { + const [selectedOption, setSelectedOption] = useState(0); useEffect(() => { window.scrollTo(0, 0); }, []); - const option2Render = option2Steps.map((step, index) => ( - - )); + let selectOption = (option: number) => { + setSelectedOption(option); + }; - const option1Render = option1Steps.map((step, index) => ( + const renderSteps = selectedOption === 0 ? option1Steps : option2Steps; + const stepsRender = renderSteps.map((step: any, index: number) => ( +
+ + +

Follow the following steps to add your projects to ProjectsHut:

-
{option1Render}
-
{option2Render}
+
{stepsRender}