diff --git a/components/Shared/CopyText.styled.ts b/components/Shared/CopyText.styled.ts index 73de9300..64237fca 100644 --- a/components/Shared/CopyText.styled.ts +++ b/components/Shared/CopyText.styled.ts @@ -6,13 +6,12 @@ const StyledStatus = styled("span", { display: "flex", alignContent: "center", alignItems: "center", - padding: "0 $gr1", - marginLeft: "$gr1", - backgroundColor: "$darkBlueA", - color: "$white", + color: "$darkBlueA", borderRadius: "3px", fontSize: "$gr1", textTransform: "uppercase", + position: "absolute", + right: "-1.25em", }); const StyledCopyText = styled("button", { @@ -30,6 +29,8 @@ const StyledCopyText = styled("button", { textDecorationThickness: "min(2px,max(1px,.05em))", textUnderlineOffset: "calc(.05em + 2px)", textDecorationColor: "$purple10", + position: "relative", + zIndex: "0", svg: { height: "calc($gr3 - 3px)", diff --git a/components/Shared/IIIF/Share.tsx b/components/Shared/IIIF/Share.tsx index e9baee13..ca5c5071 100644 --- a/components/Shared/IIIF/Share.tsx +++ b/components/Shared/IIIF/Share.tsx @@ -5,7 +5,6 @@ import { IconChevronDown, IconExternalLink } from "../SVG/Icons"; import CopyText from "../CopyText"; import IIIFLogo from "../SVG/IIIF"; -import { color } from "framer-motion"; import { styled } from "@/stitches.config"; const IIIFShare = ({ uri }: { uri: string }) => { @@ -27,15 +26,35 @@ const IIIFShare = ({ uri }: { uri: string }) => { sideOffset={3} collisionPadding={19} > + View in... - View in Clover IIIF + Clover IIIF + + + Mirador + + + + + Theseus + + + View Raw JSON @@ -44,6 +63,7 @@ const IIIFShare = ({ uri }: { uri: string }) => { + { span:last-child svg path": { + stroke: "$purple !important", + }, }, }, }); @@ -134,30 +159,16 @@ const StyledIIIFShareContent = styled(Dropdown.Content, { display: "flex", flexDirection: "column", fontSize: "$gr2 ", - fontFamily: "$northwesternSansRegular", minWidth: "160px", gap: "$gr2", a: { - textDecoration: "underline", - textDecorationThickness: "min(2px,max(1px,.05em))", - textUnderlineOffset: "calc(.05em + 2px)", - textDecorationColor: "$purple10", - color: "$black50", - - "&[data-id='what-is-iiif']": { - display: "flex", - - [`${IconStyled}`]: { - marginTop: "-3px", - }, - }, + color: "$purple", + display: "flex", - "&:hover, &:active": { - svg: { - color: "$purple", - fill: "$purple", - }, + svg: { + color: "$purple", + fill: "$purple", }, }, @@ -167,17 +178,19 @@ const StyledIIIFShareContent = styled(Dropdown.Content, { padding: "0 !important", fontWeight: "400", lineHeight: "inherit !important", - textDecoration: "underline", - textDecorationThickness: "min(2px,max(1px,.05em))", - textUnderlineOffset: "calc(.05em + 2px)", - textDecorationColor: "$purple10", - color: "$black50", - - "&:hover": { - color: "$purple", - fill: "$purple", - }, + textDecoration: "none", + color: "$purple", }, }); +const StyledDropdownLabel = styled(Dropdown.Separator, { + fontSize: "$gr2 ", + color: "$black50", +}); + +const StyledDropdownSeparator = styled(Dropdown.Separator, { + height: "1px", + backgroundColor: "$gray6", +}); + export default IIIFShare; diff --git a/hooks/useCopyToClipboard.ts b/hooks/useCopyToClipboard.ts index 6660a88d..eddfd308 100644 --- a/hooks/useCopyToClipboard.ts +++ b/hooks/useCopyToClipboard.ts @@ -1,18 +1,22 @@ -import { useCallback, useEffect, useState } from "react"; +import { MouseEvent, useCallback, useEffect, useState } from "react"; -export type CopyStatus = "copied" | "failed" | undefined; +export type CopyStatus = "✔" | "✗" | undefined; export const useCopyToClipboard = ( text: string, - notifyTimeout = 2500, -): [CopyStatus, () => void] => { + notifyTimeout = 5000, +): [CopyStatus, (event: MouseEvent) => void] => { const [copyStatus, setCopyStatus] = useState(); - const copy = useCallback(() => { - navigator.clipboard.writeText(text).then( - () => setCopyStatus("copied"), - () => setCopyStatus("failed"), - ); - }, [text]); + const copy = useCallback( + (event: MouseEvent) => { + event?.preventDefault(); + navigator.clipboard.writeText(text).then( + () => setCopyStatus("✔"), + () => setCopyStatus("✗"), + ); + }, + [text], + ); useEffect(() => { if (!copyStatus) {