diff --git a/components/system/components/GlobalCarousel/jumpers/Share.js b/components/system/components/GlobalCarousel/jumpers/Share.js new file mode 100644 index 00000000..23abb492 --- /dev/null +++ b/components/system/components/GlobalCarousel/jumpers/Share.js @@ -0,0 +1,155 @@ +import * as React from "react"; +import * as Styles from "~/common/styles"; +import * as System from "~/components/system"; +import * as Jumper from "~/components/core/Jumper"; +import * as SVG from "~/common/svg"; +import * as Utilities from "~/common/utilities"; +import * as Constants from "~/common/constants"; +import * as MobileJumper from "~/components/system/components/GlobalCarousel/jumpers/MobileLayout"; + +import { css } from "@emotion/react"; + +const STYLES_SHARING_BUTTON = (theme) => css` + ${Styles.BUTTON_RESET}; + ${Styles.HORIZONTAL_CONTAINER_CENTERED}; + padding: 9px 8px 11px; + border-radius: 12px; + width: 100%; + :hover, + :active { + background-color: ${theme.semantic.bgGrayLight}; + } +`; + +function FileSharingButtons({ file, data }) { + const username = data?.user?.username; + const fileName = file?.name || file?.filename; + const rootUrl = window?.location?.origin; + const fileLink = `${rootUrl}/${username}/web?cid=${file.cid}`; + const [copyState, setCopyState] = React.useState({ isCidCopied: false, isLinkCopied: false }); + + const handleTwitterSharing = () => + window.open( + `https://twitter.com/intent/tweet?text=${fileName} by ${username} on Slate%0D&url=${fileLink}`, + "_blank" + ); + + const handleEmailSharing = () => { + window.open(`mailto: ?subject=${fileName} by ${username} on Slate&body=${fileLink}`, "_b"); + }; + + const handleLinkCopy = () => ( + Utilities.copyToClipboard(fileLink), setCopyState({ isLinkCopied: true }) + ); + const handleCidCopy = () => ( + Utilities.copyToClipboard(file.cid), setCopyState({ isCidCopied: true }) + ); + + return ( + <> + + + + + + ); +} + +/* -----------------------------------------------------------------------------------------------*/ + +const STYLES_SHARE_FILE_FOOTER = (theme) => css` + ${Styles.HORIZONTAL_CONTAINER_CENTERED}; + position: absolute; + bottom: 0; + left: 0; + width: 100%; + height: 50px; + color: ${theme.semantic.textGrayDark}; + background-color: ${theme.semantic.bgWhite}; +`; + +const PROTO_SCHOOL_CID = "https://proto.school/anatomy-of-a-cid/01"; + +export function Share({ file, data, isOpen, onClose }) { + return isOpen ? ( + + Share + + + + + + + + + + + + What is CID? + + + + ) : null; +} + +export function ShareMobile({ file, data, isOpen, onClose }) { + return isOpen ? ( + + + + Share + + + +
+ +
+ + + + + + + + + What is CID? + + +
+ ) : null; +}