-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/share buttons #140
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c9cd8ef
Beginning Share Button work
thomas-desmond a3474fe
Added more socials and copy URL button
thomas-desmond d5c7bbc
Matching Changelog UX
thomas-desmond d9cf43e
Update ShareModal component with additional social media sharing options
thomas-desmond ab9b676
Update email share button in ShareModal.tsx
thomas-desmond ec61205
Match icon spacing to dev portal
thomas-desmond 61004e6
Merge branch 'main' into feature/share-buttons
thomas-desmond e2e55d1
Add test step to check that Share modal opens
thomas-desmond File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,79 @@ | ||
import React from 'react' | ||
import { useRouter } from 'next/router' | ||
import { Button, HStack, Input, Modal, ModalBody, ModalCloseButton, ModalContent, ModalHeader, ModalOverlay, useDisclosure, useClipboard } from '@chakra-ui/react'; | ||
import { XIcon, TwitterShareButton, LinkedinIcon, LinkedinShareButton, EmailShareButton, EmailIcon, WhatsappShareButton, TelegramShareButton, RedditShareButton, WhatsappIcon, TelegramIcon, RedditIcon } from "react-share"; | ||
import { MdContentCopy } from "react-icons/md"; | ||
|
||
const shareText = "I just completed the Sitecore Migration Advisor assessment and got my migration resources. Check it out!" | ||
|
||
export default function ShareModal() { | ||
const { isOpen, onOpen, onClose } = useDisclosure() | ||
|
||
const router = useRouter() | ||
|
||
let shareUrl = '' | ||
if (typeof window !== 'undefined') { | ||
shareUrl = window.location.origin + router.asPath; | ||
} | ||
const { onCopy, value, setValue, hasCopied } = useClipboard(shareUrl); | ||
|
||
return ( | ||
<div> | ||
<Button id='shareButton' onClick={onOpen}>Share</Button> | ||
|
||
<Modal isOpen={isOpen} onClose={onClose}> | ||
<ModalOverlay /> | ||
<ModalContent> | ||
<ModalHeader>Share Your Migration Advisor Results</ModalHeader> | ||
<ModalCloseButton /> | ||
<ModalBody mb={2}> | ||
<HStack mb={2} justifyContent={'center'} gap={4} > | ||
<WhatsappShareButton | ||
url={shareUrl} | ||
title={shareText}> | ||
<WhatsappIcon size={32} round={true} /> | ||
</WhatsappShareButton> | ||
<TelegramShareButton | ||
url={shareUrl} | ||
title={shareText}> | ||
<TelegramIcon size={32} round={true} /> | ||
</TelegramShareButton> | ||
<RedditShareButton | ||
url={shareUrl} | ||
title={shareText}> | ||
<RedditIcon size={32} round={true} /> | ||
</RedditShareButton> | ||
<EmailShareButton | ||
url={shareUrl} | ||
subject='Sitecore Migration Advisor Results' | ||
body={shareText}> | ||
<EmailIcon size={32} round={true} /> | ||
</EmailShareButton> | ||
<LinkedinShareButton | ||
url={shareUrl} | ||
title={shareText}> | ||
<LinkedinIcon size={32} round={true} /> | ||
</LinkedinShareButton> | ||
<TwitterShareButton | ||
url={shareUrl} | ||
title={shareText}> | ||
<XIcon size={32} round={true} /> | ||
</TwitterShareButton> | ||
</HStack> | ||
<HStack> | ||
<Input | ||
value={shareUrl} | ||
contentEditable={false} | ||
onChange={(e) => { | ||
setValue(e.target.value); | ||
}} | ||
mr={2} | ||
/> | ||
<Button whiteSpace={'nowrap'} onClick={onCopy}><MdContentCopy /></Button> | ||
</HStack> | ||
</ModalBody> | ||
</ModalContent> | ||
</Modal> | ||
</div > | ||
) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if combining multiple things in a test is a good idea. For now just a generalized comment. Nothing to change I don't think. But I was wondering how you might use before (which could run the steps to get to the outcome page) and then have individual tests for each of the cases you want to test. Not sure that's how that feature works lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely don't want to run the same flow multiple times to test different things. So I'm not sure that which I thought of works where it only runs the test once up to the outcome page, but maybe something to look into?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. We should have a few full-flow tests from beginning to end, but I don't want one test to end up testing 15 things working on the outcome page.
I think now that we have outcome pages we could visit the URL
/outcome/48fc3ad8-ecc4-4a53-a07b-2cd136a59959
as the first step of the cypress test. We don't need to go through the whole flow for certain things like the share button.Merging this for now but any further outcome page tests we should consider just navigating directly to a known existing outcome.