-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Expand file tree
/
Copy pathDisambiguatedProfile.stories.tsx
More file actions
93 lines (81 loc) · 2.61 KB
/
DisambiguatedProfile.stories.tsx
File metadata and controls
93 lines (81 loc) · 2.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
* Copyright 2026 Element Creations Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
* Please see LICENSE files in the repository root for full details.
*/
import React, { type JSX } from "react";
import { fn } from "storybook/test";
import type { Meta, StoryObj } from "@storybook/react-vite";
import {
DisambiguatedProfileView,
type DisambiguatedProfileViewSnapshot,
type DisambiguatedProfileViewActions,
} from "./DisambiguatedProfileView";
import { useMockedViewModel } from "../../../../../core/viewmodel";
import { withViewDocs } from "../../../../../../.storybook/withViewDocs";
type DisambiguatedProfileProps = DisambiguatedProfileViewSnapshot & DisambiguatedProfileViewActions;
const DisambiguatedProfileViewWrapperImpl = ({
onClick,
className,
...rest
}: DisambiguatedProfileProps & { className?: string }): JSX.Element => {
const vm = useMockedViewModel(rest, { onClick });
return <DisambiguatedProfileView vm={vm} className={className} />;
};
const DisambiguatedProfileViewWrapper = withViewDocs(DisambiguatedProfileViewWrapperImpl, DisambiguatedProfileView);
const meta = {
title: "Timeline/Timeline Event/DisambiguatedProfile",
component: DisambiguatedProfileViewWrapper,
tags: ["autodocs"],
argTypes: {
displayName: { control: "text" },
colorClass: { control: "text" },
className: { control: "text" },
displayIdentifier: { control: "text" },
title: { control: "text" },
emphasizeDisplayName: { control: "boolean" },
},
args: {
displayName: "Alice",
emphasizeDisplayName: true,
onClick: fn(),
},
} satisfies Meta<typeof DisambiguatedProfileViewWrapper>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Default: Story = {};
export const WithMxid: Story = {
args: {
displayName: "Alice",
displayIdentifier: "@alice:example.org",
colorClass: "mx_Username_color1",
},
};
export const WithColorClass: Story = {
args: {
displayName: "Bob",
colorClass: "mx_Username_color3",
},
};
export const Emphasized: Story = {
args: {
displayName: "Charlie",
emphasizeDisplayName: true,
},
};
export const WithTooltip: Story = {
args: {
displayName: "Diana",
title: "Diana (@diana:example.org)",
},
};
export const FullExample: Story = {
args: {
displayName: "Eve",
displayIdentifier: "@eve:matrix.org",
colorClass: "mx_Username_color5",
title: "Eve (@eve:matrix.org)",
emphasizeDisplayName: true,
},
};