-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Expand file tree
/
Copy pathWidgetContextMenuView.stories.tsx
More file actions
87 lines (79 loc) · 2.64 KB
/
WidgetContextMenuView.stories.tsx
File metadata and controls
87 lines (79 loc) · 2.64 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
/*
* Copyright 2025 New Vector 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 { IconButton } from "@vector-im/compound-web";
import TriggerIcon from "@vector-im/compound-design-tokens/assets/web/icons/overflow-horizontal";
import type { Meta, StoryObj } from "@storybook/react-vite";
import {
type WidgetContextMenuViewActions,
type WidgetContextMenuViewSnapshot,
WidgetContextMenuView,
} from "./WidgetContextMenuView";
import { useMockedViewModel } from "../../../core/viewmodel/useMockedViewModel";
import { withViewDocs } from "../../../../.storybook/withViewDocs";
type WidgetContextMenuViewModelProps = WidgetContextMenuViewSnapshot & WidgetContextMenuViewActions;
const WidgetContextMenuViewWrapperImpl = ({
onStreamAudioClick,
onEditClick,
onSnapshotClick,
onDeleteClick,
onRevokeClick,
onFinished,
onMoveButton,
...rest
}: WidgetContextMenuViewModelProps): JSX.Element => {
const vm = useMockedViewModel(rest, {
onStreamAudioClick,
onEditClick,
onSnapshotClick,
onDeleteClick,
onRevokeClick,
onFinished,
onMoveButton,
});
return <WidgetContextMenuView vm={vm} />;
};
const WidgetContextMenuViewWrapper = withViewDocs(WidgetContextMenuViewWrapperImpl, WidgetContextMenuView);
const meta = {
title: "Room/WidgetContextMenuView",
component: WidgetContextMenuViewWrapper,
tags: ["autodocs"],
args: {
showStreamAudioStreamButton: true,
showEditButton: true,
showRevokeButton: true,
showDeleteButton: true,
showSnapshotButton: true,
showMoveButtons: [true, true],
canModify: true,
isMenuOpened: true,
trigger: (
<IconButton size="24px" aria-label="context menu trigger button" inert={true} tabIndex={-1}>
<TriggerIcon />
</IconButton>
),
onStreamAudioClick: fn(),
onEditClick: fn(),
onSnapshotClick: fn(),
onDeleteClick: fn(),
onRevokeClick: fn(),
onFinished: fn(),
onMoveButton: fn(),
},
} satisfies Meta<typeof WidgetContextMenuViewWrapper>;
export default meta;
type Story = StoryObj<typeof WidgetContextMenuViewWrapper>;
export const Default: Story = {};
export const OnlyBasicModification: Story = {
args: {
showSnapshotButton: false,
showMoveButtons: [false, false],
showStreamAudioStreamButton: false,
showEditButton: false,
},
};