-
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 #24 from SmartCityFlensburg/feature/add-faq-section
feat: add faq section
- Loading branch information
Showing
8 changed files
with
139 additions
and
6 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,11 @@ | ||
html { | ||
scrollbar-gutter: stable; | ||
} | ||
|
||
details > summary { | ||
@apply list-none; | ||
} | ||
|
||
details > summary::-webkit-details-marker { | ||
@apply hidden; | ||
} |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
@import './components/fonts.css'; | ||
@import './components/general.css'; |
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React, { ReactNode, useState, useRef, useEffect } from 'react'; | ||
|
||
interface AccordionProps { | ||
label: string; | ||
children: ReactNode; | ||
} | ||
|
||
const Accordion: React.FC<AccordionProps> = ({ label, children }) => { | ||
const [open, setOpen] = useState(false); | ||
const [maxHeight, setMaxHeight] = useState('auto'); | ||
const accordionPanel = useRef<HTMLDivElement>(null); | ||
|
||
const toggleAccordion = () => { | ||
setOpen(!open); | ||
}; | ||
|
||
useEffect(() => { | ||
if (! accordionPanel.current) return; | ||
setMaxHeight(`${accordionPanel.current.scrollHeight + 40}px`); | ||
|
||
if (! open) { | ||
setTimeout(() => setMaxHeight('0px'), 0); | ||
} | ||
}, [open]); | ||
|
||
return ( | ||
<li className={`cursor-pointer border border-green-dark-900 rounded-2xl shadow-md ${open ? 'border-green-light-900' : 'border-green-dark-900'}`}> | ||
<summary | ||
aria-expanded={open} | ||
className={`px-4 py-3 rounded-t-2xl cursor-pointer flex items-center justify-between gap-x-4 font-semibold font-lato transition-color ease-in-out duration-300 md:px-6 md:py-4 hover:bg-green-dark-900/10 ${open ? 'bg-green-light-900/10' : ''}`} | ||
onClick={toggleAccordion} | ||
> | ||
<h3 className="w-[85%] lg:text-lg">{label}</h3> | ||
<figure | ||
className={`w-7 h-7 rounded-full text-white flex items-center justify-center transition-all ease-in-out duration-300 ${open ? 'bg-green-light-900 rotate-180' : 'bg-green-dark-900'}`} | ||
> | ||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" className="size-6"> | ||
<path strokeLinecap="round" strokeLinejoin="round" d="m19.5 8.25-7.5 7.5-7.5-7.5" /> | ||
</svg> | ||
</figure> | ||
</summary> | ||
<div | ||
ref={accordionPanel} | ||
style={{maxHeight}} | ||
className={`text-base leading-relaxed overflow-hidden px-4 transition-all ease-in-out duration-300 border-t md:px-6 ${open ? 'border-t-green-light-900 pt-3 py-4 md:pb-6' : 'border-t-transparent'}`} | ||
> | ||
{children} | ||
</div> | ||
</li> | ||
); | ||
}; | ||
|
||
export default Accordion; |
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,61 @@ | ||
import Accordion from "./Accordion"; | ||
|
||
function Faq() { | ||
return ( | ||
<section className="px-4 max-w-208 mx-auto my-28 md:px-6 lg:my-36 xl:my-44"> | ||
<h2 className="font-lato font-bold text-center text-2xl mb-6 lg:mb-10 lg:text-3xl"> | ||
Oft gestellte Fragen zu Green Ecolution | ||
</h2> | ||
<ul className="flex flex-col gap-y-4 md:gap-y-6"> | ||
<Accordion label="Wer steckt hinter dem Projekt Green Ecolution?"> | ||
<p className="mb-4"> | ||
Do do ex aliquip est voluptate Lorem est fugiat amet consectetur veniam irure enim id. | ||
Officia deserunt dolor sint aliquip. | ||
Cupidatat consequat consequat aute sint. Cupidatat fugiat tempor cupidatat cillum in officia anim voluptate cillum mollit. | ||
Est minim fugiat amet non. | ||
</p> | ||
<p> | ||
Tempor amet consectetur in eiusmod quis adipisicing nulla incididunt incididunt tempor. | ||
Do est esse pariatur qui. Laboris non aute Lorem amet minim elit fugiat aliqua ipsum sint fugiat ipsum cillum ad ipsum. | ||
Qui eu irure reprehenderit anim sint deserunt consequat elit in excepteur aliquip excepteur tempor. | ||
Velit adipisicing Lorem nostrud consectetur proident ut. Tempor deserunt laboris tempor dolor dolore ad voluptate. | ||
In culpa commodo commodo aute cillum ex elit. Esse aliquip labore elit consequat. | ||
</p> | ||
</Accordion> | ||
<Accordion label="Welchen Mehrwert bietet das Projekt?"> | ||
<p> | ||
Do do ex aliquip est voluptate Lorem est fugiat amet consectetur veniam irure enim id. | ||
Officia deserunt dolor sint aliquip. | ||
Cupidatat consequat consequat aute sint. Cupidatat fugiat tempor cupidatat cillum in officia anim voluptate cillum mollit. | ||
Est minim fugiat amet non. | ||
</p> | ||
</Accordion> | ||
<Accordion label="Was bedeutet das, dass das Projekt öffentlich zugänglich ist?"> | ||
<p className="mb-4"> | ||
Do do ex aliquip est voluptate Lorem est fugiat amet consectetur veniam irure enim id. | ||
Officia deserunt dolor sint aliquip. | ||
Cupidatat consequat consequat aute sint. Cupidatat fugiat tempor cupidatat cillum in officia anim voluptate cillum mollit. | ||
Est minim fugiat amet non. | ||
</p> | ||
<p> | ||
Tempor amet consectetur in eiusmod quis adipisicing nulla incididunt incididunt tempor. | ||
Do est esse pariatur qui. Laboris non aute Lorem amet minim elit fugiat aliqua ipsum sint fugiat ipsum cillum ad ipsum. | ||
Qui eu irure reprehenderit anim sint deserunt consequat elit in excepteur aliquip excepteur tempor. | ||
Velit adipisicing Lorem nostrud consectetur proident ut. Tempor deserunt laboris tempor dolor dolore ad voluptate. | ||
In culpa commodo commodo aute cillum ex elit. Esse aliquip labore elit consequat. | ||
</p> | ||
</Accordion> | ||
<Accordion label="Welche Sensoren werden verwendet?"> | ||
<p> | ||
Do do ex aliquip est voluptate Lorem est fugiat amet consectetur veniam irure enim id. | ||
Officia deserunt dolor sint aliquip. | ||
Cupidatat consequat consequat aute sint. Cupidatat fugiat tempor cupidatat cillum in officia anim voluptate cillum mollit. | ||
Est minim fugiat amet non. | ||
</p> | ||
</Accordion> | ||
</ul> | ||
</section> | ||
); | ||
} | ||
|
||
export default Faq; |
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