-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #437 from thepolicylab-projectportals/398-add-faq-…
…projects feat: add faq section to project details page
- Loading branch information
Showing
10 changed files
with
131 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from "react" | ||
import { Accordion } from "@thepolicylab-projectportals/gatsby-theme-project-portal/src/components/Accordion" | ||
|
||
const twoElems = [ | ||
{ title: "Topic A", text: "topic-a" }, | ||
{ title: "Topic B", text: "topic-b" }, | ||
] | ||
const AccordionTest = () => { | ||
return ( | ||
<> | ||
<h2>Various Behaviours of Accordion Component</h2> | ||
<h3>Accordion with two elements:</h3> | ||
{twoElems.map(({ title, text }, i) => ( | ||
<Accordion key={"collapsibleList_" + i} title={title} text={text} /> | ||
))} | ||
<h3>Accordion with no elements:</h3> | ||
<Accordion title={"No text elements:"}></Accordion> | ||
<h3>Has elements, but they are empty:</h3> | ||
<Accordion title={""} text={""}></Accordion> | ||
<h3>Accordion with one item:</h3> | ||
<Accordion | ||
title={"We only get one question"} | ||
text={"And we hate answering it."} | ||
></Accordion> | ||
</> | ||
) | ||
} | ||
|
||
export default AccordionTest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
packages/gatsby-theme-project-portal/src/components/Accordion.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from "react" | ||
import { Disclosure } from "@headlessui/react" | ||
import { FaMinus, FaPlus } from "react-icons/fa" | ||
import { MarkdownText } from "./MarkdownText" | ||
|
||
interface AccordionProps { | ||
title: string | ||
text: string | ||
} | ||
|
||
export const Accordion: React.FC<AccordionProps> = ({ title, text }) => { | ||
return ( | ||
<div className="w-full my-6"> | ||
<Disclosure> | ||
{({ open }) => ( | ||
<> | ||
<Disclosure.Button className="flex items-center justify-between w-full px-4 py-3 text-left bg-navbar"> | ||
<span className="text-h4 font-bold">{title}</span> | ||
{open ? <FaMinus /> : <FaPlus />} | ||
</Disclosure.Button> | ||
<Disclosure.Panel className="text-body p-4 w-9/10"> | ||
<MarkdownText text={text} /> | ||
</Disclosure.Panel> | ||
</> | ||
)} | ||
</Disclosure> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,6 +59,10 @@ export const query = graphql` | |
} | ||
} | ||
} | ||
faq { | ||
text | ||
title | ||
} | ||
} | ||
} | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters