feat: Add 'share' option for documents on mobile

This commit is contained in:
Tom Moor
2023-11-21 22:27:54 -05:00
parent e109c8a265
commit c75d769d9e
4 changed files with 58 additions and 6 deletions

View File

@@ -27,10 +27,17 @@ import useStores from "~/hooks/useStores";
import useUserLocale from "~/hooks/useUserLocale";
type Props = {
/** The document to share. */
document: Document;
/** The existing share model, if any. */
share: Share | null | undefined;
/** The existing share parent model, if any. */
sharedParent: Share | null | undefined;
/** Whether to hide the title. */
hideTitle?: boolean;
/** Callback fired when the popover requests to be closed. */
onRequestClose: () => void;
/** Whether the popover is visible. */
visible: boolean;
};
@@ -38,6 +45,7 @@ function SharePopover({
document,
share,
sharedParent,
hideTitle,
onRequestClose,
visible,
}: Props) {
@@ -213,10 +221,16 @@ function SharePopover({
return (
<>
<Heading>
{isPubliclyShared ? <GlobeIcon size={28} /> : <PadlockIcon size={28} />}
<span>{t("Share this document")}</span>
</Heading>
{!hideTitle && (
<Heading>
{isPubliclyShared ? (
<GlobeIcon size={28} />
) : (
<PadlockIcon size={28} />
)}
<span>{t("Share this document")}</span>
</Heading>
)}
{sharedParent && !document.isDraft && (
<NoticeWrapper>