-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
249 additions
and
22 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+21.2 KB
images/Transactions-in-the-wholesale-electricity-market-in-Serbia.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+173 KB
public/images/Transactions-in-the-wholesale-electricity-market-in-Serbia-lg.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+62.3 KB
public/images/Transactions-in-the-wholesale-electricity-market-in-Serbia-md.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+23.9 KB
public/images/Transactions-in-the-wholesale-electricity-market-in-Serbia-sm.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,146 @@ | ||
import { | ||
HStack, | ||
Text, | ||
Stack, | ||
SimpleGrid, | ||
Button, | ||
Modal, | ||
ModalOverlay, | ||
ModalContent, | ||
ModalHeader, | ||
ModalBody, | ||
ModalCloseButton, | ||
useDisclosure, | ||
} from "@chakra-ui/react" | ||
|
||
import { | ||
ShareIcon, | ||
CloseIcon, | ||
TwitterIcon, | ||
LinkedInIcon, | ||
FacebookIcon, | ||
EmailIcon, | ||
} from "@/components/Icon" | ||
import { ButtonLink } from "@/components/Link" | ||
import useShareButton from "./useShareButton" | ||
|
||
export default function PageHeaderShareButton(props) { | ||
const { isOpen, onClose, onOpen } = useDisclosure() | ||
const shareLinks = useShareButton() | ||
return ( | ||
<HStack spacing={0}> | ||
<Button | ||
colorScheme="gray" | ||
borderRadius="sm" | ||
rightIcon={<ShareIcon size="1.25rem" />} | ||
onClick={onOpen} | ||
{...props} | ||
/> | ||
|
||
<Modal isOpen={isOpen} onClose={onClose}> | ||
<ModalOverlay /> | ||
<ModalContent maxW="46rem" mx={5} borderRadius="none"> | ||
<ModalCloseButton | ||
top={3} | ||
right={3} | ||
borderRadius="none" | ||
w={10} | ||
h={10} | ||
_focusVisible={{ | ||
outline: "0.125rem solid black", | ||
outlineOffset: "0.125rem", | ||
}} | ||
> | ||
<CloseIcon size="1.75rem" aria-hidden="true" focusable="false" /> | ||
</ModalCloseButton> | ||
<ModalHeader | ||
pt={16} | ||
pb={3} | ||
px={10} | ||
fontWeight={700} | ||
fontSize="3xl" | ||
lineHeight="shorter" | ||
> | ||
{"Share this content"} | ||
</ModalHeader> | ||
<ModalBody pt={0} pb={10} px={10}> | ||
<Stack spacing={6}> | ||
<Text color="gray.500" fontSize="lg"> | ||
{ | ||
"Spread the word and share this page with your audience across various social channels" | ||
} | ||
</Text> | ||
<SimpleGrid columns={[2]} gridGap={6}> | ||
<ButtonLink | ||
bg="black" | ||
color="white" | ||
_hover={{ bg: "twitter.500" }} | ||
_focusVisible={{ | ||
bg: "twitter.500", | ||
outline: "0.125rem solid", | ||
outlineColor: "twitter.500", | ||
}} | ||
textAlign="left" | ||
justifyContent="flex-start" | ||
leftIcon={<TwitterIcon />} | ||
href={shareLinks.twitter} | ||
> | ||
{"X (Twitter)"} | ||
</ButtonLink> | ||
<ButtonLink | ||
bg="black" | ||
color="white" | ||
_hover={{ bg: "facebook.500" }} | ||
_focusVisible={{ | ||
bg: "facebook.500", | ||
outline: "0.125rem solid", | ||
outlineColor: "facebook.500", | ||
}} | ||
textAlign="left" | ||
justifyContent="flex-start" | ||
leftIcon={<FacebookIcon />} | ||
href={shareLinks.facebook} | ||
> | ||
{"Facebook"} | ||
</ButtonLink> | ||
<ButtonLink | ||
bg="black" | ||
color="white" | ||
_hover={{ bg: "linkedin.500" }} | ||
_focusVisible={{ | ||
bg: "linkedin.500", | ||
outline: "0.125rem solid", | ||
outlineColor: "linkedin.500", | ||
}} | ||
textAlign="left" | ||
justifyContent="flex-start" | ||
leftIcon={<LinkedInIcon />} | ||
href={shareLinks.linkedin} | ||
> | ||
{"LinkedIn"} | ||
</ButtonLink> | ||
<ButtonLink | ||
bg="black" | ||
color="white" | ||
_hover={{ bg: "brand.500", color: "brand.1000" }} | ||
_focusVisible={{ | ||
bg: "brand.500", | ||
color: "brand.1000", | ||
outline: "0.125rem solid", | ||
outlineColor: "brand.500", | ||
}} | ||
textAlign="left" | ||
justifyContent="flex-start" | ||
leftIcon={<EmailIcon />} | ||
href={shareLinks.email} | ||
> | ||
{"Email"} | ||
</ButtonLink> | ||
</SimpleGrid> | ||
</Stack> | ||
</ModalBody> | ||
</ModalContent> | ||
</Modal> | ||
</HStack> | ||
) | ||
} |
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,48 @@ | ||
import { useRouter } from "next/router" | ||
|
||
const siteUrl = "https://www.global-climatescope.org/" | ||
|
||
export default function useShareButton(opts) { | ||
const { platform } = opts || {} | ||
const router = useRouter() | ||
const shareLinks = getShareLinks(router.asPath) | ||
return platform ? shareLinks[platform] || "" : shareLinks | ||
} | ||
|
||
function getShareUrl(siteUrl, asPath) { | ||
const [a, b] = siteUrl.split("//") | ||
return `${a}//${b | ||
.split("/") | ||
.filter((d) => d) | ||
.join("/")}${asPath}` | ||
} | ||
|
||
function getShareLinks(asPath) { | ||
const twitterRoot = "http://twitter.com/intent/tweet" | ||
const facebookRoot = "http://facebook.com/sharer/sharer.php" | ||
const linkedinRoot = "http://linkedin.com/shareArticle" | ||
|
||
const shareUrl = getShareUrl(siteUrl, asPath) | ||
|
||
const twitterShareText = `Discover the most attractive markets for energy transition investment. @BloombergNEF` | ||
const facebookShareText = `${shareUrl}` | ||
const emailSubject = `Climatescope 2024` | ||
const emailBody = `${shareUrl}` | ||
|
||
const encodedTwitterShareText = encodeURIComponent(twitterShareText) | ||
const encodedFacebookShareText = encodeURIComponent(facebookShareText) | ||
|
||
const twitterShareUrl = `${twitterRoot}?url=${shareUrl}&text=${encodedTwitterShareText}&original_referer=${shareUrl}` | ||
const facebookShareUrl = `${facebookRoot}?u=${shareUrl}&text=${encodedFacebookShareText}&original_referer=${shareUrl}` | ||
const linkedinShareUrl = `${linkedinRoot}?url=${shareUrl}` | ||
const emailShareUrl = `mailto:?subject=${encodeURIComponent( | ||
emailSubject | ||
)}&body=${emailBody}` | ||
|
||
return { | ||
twitter: twitterShareUrl, | ||
facebook: facebookShareUrl, | ||
linkedin: linkedinShareUrl, | ||
email: emailShareUrl, | ||
} | ||
} |