-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: abstract options component, fix popover not showing, add questio…
…n icon,
- Loading branch information
Showing
6 changed files
with
105 additions
and
22 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,55 @@ | ||
import ExternalLink from "components/ExternalLink" | ||
import Popover from "components/Popover" | ||
import React from "react"; | ||
import Image from "next/image"; | ||
|
||
|
||
const Options: React.FC = () => { | ||
return ( | ||
<div className="flex flex-row mt-[16px] md:mt-0"> | ||
<ExternalLink href="https://snapshot.org/#/poh.eth/"> | ||
<Image alt="snapshot" src="/logo/snapshot.svg" height={16} width={16} /> | ||
</ExternalLink> | ||
|
||
<Popover | ||
trigger={ | ||
<Image | ||
alt="question" | ||
className="cursor-pointer ml-2" | ||
src={"/logo/question.svg"} | ||
height={16} | ||
width={16} | ||
/> | ||
} | ||
> | ||
<div className="p-2 h-fit grid grid-cols-1 gap-2"> | ||
<ExternalLink href="https://t.me/proofhumanity"> | ||
Get Help (English) | ||
</ExternalLink> | ||
<ExternalLink href="https://t.me/proofofhumanityenespanol"> | ||
Get Help (Spanish) | ||
</ExternalLink> | ||
<ExternalLink href="https://gov.proofofhumanity.id/"> | ||
Forums | ||
</ExternalLink> | ||
<ExternalLink href="https://t.me/pohDebug"> | ||
Report Bugs (Telegram) | ||
</ExternalLink> | ||
<ExternalLink href="https://github.com/Proof-Of-Humanity/proof-of-humanity-web/issues"> | ||
Report Bugs (Github) | ||
</ExternalLink> | ||
<ExternalLink href="https://kleros.gitbook.io/docs/products/proof-of-humanity/proof-of-humanity-tutorial"> | ||
Tutorial | ||
</ExternalLink> | ||
<ExternalLink href="https://ethereum.org/en/wallets"> | ||
Crypto Beginner's Guide | ||
</ExternalLink> | ||
<ExternalLink href="https://kleros.gitbook.io/docs/products/proof-of-humanity/poh-faq"> | ||
FAQ | ||
</ExternalLink> | ||
</div> | ||
</Popover> | ||
</div> | ||
); | ||
}; | ||
export default Options; |
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 |
---|---|---|
@@ -1,16 +1,38 @@ | ||
import Popup from "reactjs-popup"; | ||
import { useEffect, useState } from "react"; | ||
|
||
interface PopoverInterface { | ||
trigger: JSX.Element; | ||
children: React.ReactNode; | ||
} | ||
|
||
const Popover: React.FC<PopoverInterface> = ({ trigger, children }) => ( | ||
<Popup trigger={trigger} position="bottom right" arrow={false}> | ||
<div className="w-48 mt-1 bg-white rounded shadow-md shadow-shade-500/50"> | ||
{children} | ||
</div> | ||
</Popup> | ||
); | ||
const Popover: React.FC<PopoverInterface> = ({ trigger, children }) => { | ||
const [position, setPosition] = useState<"bottom right" | "bottom center">("bottom right"); | ||
|
||
useEffect(() => { | ||
const updatePosition = () => { | ||
if (window.innerWidth < 768) { | ||
setPosition("bottom center"); | ||
} else { | ||
setPosition("bottom right"); | ||
} | ||
}; | ||
|
||
updatePosition(); | ||
window.addEventListener("resize", updatePosition); | ||
|
||
return () => { | ||
window.removeEventListener("resize", updatePosition); | ||
}; | ||
}, []); | ||
|
||
return ( | ||
<Popup trigger={trigger} position={position} arrow={false}> | ||
<div className="w-48 mt-1 bg-white rounded shadow-md shadow-shade-500/50"> | ||
{children} | ||
</div> | ||
</Popup> | ||
); | ||
}; | ||
|
||
export default Popover; |