Share asks the person who holds the pen to confirm their community agreed before a link turns on, and deleting an account lists each owned Rule with PDF and RULE.md export. Case-study Share copies the page link instead of opening the privacy modal, and the sign-in banner stays below the header so Share remains clickable.
77 lines
2.1 KiB
JavaScript
77 lines
2.1 KiB
JavaScript
import React, { useState } from "react";
|
|
import Share from "../../app/components/modals/Share";
|
|
|
|
/** Figma: Overlay / Modal / Share — node 24972-2094. */
|
|
export default {
|
|
title: "Components/Modals/Share",
|
|
component: Share,
|
|
parameters: {
|
|
layout: "fullscreen",
|
|
docs: {
|
|
description: {
|
|
component:
|
|
"Share settings for a finished Rule: invite people, confirm a link, or copy it.",
|
|
},
|
|
},
|
|
},
|
|
};
|
|
|
|
const previewSettings = {
|
|
visibility: "private",
|
|
shareSlug: null,
|
|
shareUrl: "https://communityrule.info/rules/rule-1",
|
|
shareUrlDisplay: null,
|
|
title: "Juniper Street Food Share",
|
|
ownerEmail: "name@example.org",
|
|
ownerInitials: "N",
|
|
readers: [
|
|
{ email: "rosa@example.org", initials: "R", role: "reader" },
|
|
{ email: "a@example.org", initials: "A", role: "reader" },
|
|
{ email: "b@example.org", initials: "B", role: "reader" },
|
|
{ email: "c@example.org", initials: "C", role: "reader" },
|
|
{ email: "d@example.org", initials: "D", role: "reader" },
|
|
{ email: "e@example.org", initials: "E", role: "reader" },
|
|
],
|
|
copyEnabled: true,
|
|
};
|
|
|
|
function ShareStoryHost() {
|
|
const [open, setOpen] = useState(true);
|
|
return (
|
|
<div className="min-h-[100dvh] bg-[var(--color-surface-invert-brand-primary)] p-6">
|
|
<button
|
|
type="button"
|
|
className="rounded-md bg-[var(--color-surface-default-primary)] px-4 py-2 text-small-paragraph text-[var(--color-content-default-primary)]"
|
|
onClick={() => setOpen(true)}
|
|
>
|
|
Open Share
|
|
</button>
|
|
<Share
|
|
isOpen={open}
|
|
onClose={() => setOpen(false)}
|
|
previewSettings={previewSettings}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export const Default = {
|
|
render: () => <ShareStoryHost />,
|
|
};
|
|
|
|
export const AnyoneWithTheLink = {
|
|
render: () => (
|
|
<Share
|
|
isOpen
|
|
onClose={() => undefined}
|
|
previewSettings={{
|
|
...previewSettings,
|
|
visibility: "shared_by_link",
|
|
shareSlug: "k7f2-9qxm",
|
|
shareUrl: "https://communityrule.info/r/k7f2-9qxm",
|
|
shareUrlDisplay: "communityrule.info/r/k7f2-9qxm",
|
|
}}
|
|
/>
|
|
),
|
|
};
|