Fix case-study share chrome, hero lockup width, and copy confirmation in the share dialog.
Marketing pages omitted create-flow nav copy, so Share rendered as a translation key; the case-study banner squeezed hero text to the thumbnail width; Copy link had no hover or copied state. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -3,8 +3,9 @@
|
||||
/**
|
||||
* Figma: Community Rule System — "Modal / Share"
|
||||
* https://www.figma.com/design/agv0VBLiBlcnSAaiAORgPR/Community-Rule-System?node-id=22073-30884
|
||||
* Copy-link hover / Copied! : 23769:27494 / 23769:27443
|
||||
*/
|
||||
import { memo, useId, useRef } from "react";
|
||||
import { memo, useCallback, useEffect, useId, useRef, useState } from "react";
|
||||
import { useTranslation } from "../../../contexts/MessagesContext";
|
||||
import { useCreateModalA11y } from "../Create/useCreateModalA11y";
|
||||
import { ShareView } from "./Share.view";
|
||||
@@ -15,9 +16,27 @@ const ShareContainer = memo<ShareProps>((props) => {
|
||||
const overlayRef = useRef<HTMLDivElement>(null);
|
||||
const titleId = useId();
|
||||
const t = useTranslation("modals.share");
|
||||
const [linkCopied, setLinkCopied] = useState(false);
|
||||
|
||||
useCreateModalA11y(props.isOpen, props.onClose, dialogRef);
|
||||
|
||||
useEffect(() => {
|
||||
if (!props.isOpen) {
|
||||
setLinkCopied(false);
|
||||
}
|
||||
}, [props.isOpen]);
|
||||
|
||||
const onCopyLinkClick = useCallback(async () => {
|
||||
try {
|
||||
const result = await props.onCopyLink();
|
||||
if (result !== false) {
|
||||
setLinkCopied(true);
|
||||
}
|
||||
} catch {
|
||||
setLinkCopied(false);
|
||||
}
|
||||
}, [props.onCopyLink]);
|
||||
|
||||
return (
|
||||
<ShareView
|
||||
{...props}
|
||||
@@ -27,6 +46,10 @@ const ShareContainer = memo<ShareProps>((props) => {
|
||||
title={t("title")}
|
||||
description={t("description")}
|
||||
copyLinkLabel={t("copyLink")}
|
||||
copiedLabel={t("copied")}
|
||||
copiedLive={t("copiedLive")}
|
||||
linkCopied={linkCopied}
|
||||
onCopyLinkClick={onCopyLinkClick}
|
||||
signalLabel={t("signal")}
|
||||
slackLabel={t("slack")}
|
||||
discordLabel={t("discord")}
|
||||
|
||||
Reference in New Issue
Block a user