Skip to content

Commit a364abd

Browse files
committed
chore: move widgetcard from shared-components to packages
1 parent 3ad4975 commit a364abd

File tree

5 files changed

+21
-19
lines changed

5 files changed

+21
-19
lines changed

src/shared-components/right-panel/WidgetCardView/WidgetCardView.stories.tsx renamed to packages/shared-components/src/right-panel/WidgetCardView/WidgetCardView.stories.tsx

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,24 @@
66
*/
77

88
import React, { type JSX } from "react";
9-
import { fn } from "storybook/test";
109

1110
import type { Meta, StoryFn } from "@storybook/react-vite";
1211
import { ViewWrapper } from "../../ViewWrapper";
13-
import { WidgetCardView, WidgetCardViewModel, WidgetCardViewSnapshot } from "./WidgetCardView";
12+
import { WidgetCardView, WidgetCardViewActions, WidgetCardViewModel, WidgetCardViewSnapshot } from "./WidgetCardView";
13+
import { Room } from "matrix-js-sdk/src/matrix";
1414

15-
const WidgeCardViewWrapper = (props: WidgetCardViewModel): JSX.Element => (
15+
type WidgetCardProps = WidgetCardViewSnapshot & WidgetCardViewActions;
16+
17+
const WidgeCardViewWrapper = (props: WidgetCardProps): JSX.Element => (
1618
<ViewWrapper<WidgetCardViewSnapshot, WidgetCardViewModel> Component={WidgetCardView} props={props} />
1719
);
1820

1921
export default {
2022
title: "RightPanel/WidgetCardView",
21-
component: WidgetCardView,
23+
component: WidgeCardViewWrapper,
2224
tags: ["autodocs"],
2325
args: {
24-
room: "roomId",
26+
room: new Room("roomId"),
2527
app: undefined,
2628
userId: "@userId",
2729
widgetPageTitle: "",
@@ -30,20 +32,20 @@ export default {
3032
creatorUserId: undefined,
3133
onClose: () => void
3234
}
33-
} as unknown as Meta<typeof WidgeCardViewWrapper>;
35+
} as Meta<typeof WidgeCardViewWrapper>;
3436

3537
const Template: StoryFn<typeof WidgeCardViewWrapper> = (args) => <WidgeCardViewWrapper {...args} />;
3638

3739
export const Default = Template.bind({});
3840

39-
export const WidgetCreated = Template.bind({});
40-
WidgetCreated.args = {
41-
room: "roomId",
42-
app: undefined,
43-
userId: "@userId",
44-
widgetPageTitle: "",
45-
widgetName: "",
46-
shouldEmptyWidgetCard: true,
47-
creatorUserId: undefined,
48-
onClose: () => void
49-
};
41+
// export const WidgetCreated = Template.bind({});
42+
// WidgetCreated.args = {
43+
// room: "roomId",
44+
// app: undefined,
45+
// userId: "@userId",
46+
// widgetPageTitle: "",
47+
// widgetName: "",
48+
// shouldEmptyWidgetCard: true,
49+
// creatorUserId: undefined,
50+
// onClose: () => void
51+
// };

src/shared-components/right-panel/WidgetCardView/WidgetCardView.tsx renamed to packages/shared-components/src/right-panel/WidgetCardView/WidgetCardView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export interface WidgetCardViewSnapshot {
3131
creatorUserId: string | undefined;
3232
}
3333

34-
interface WidgetCardViewActions {
34+
export interface WidgetCardViewActions {
3535
onClose: () => void;
3636
}
3737
/**

src/components/viewmodels/right_panel/WidgetCardViewModel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
type WidgetCardViewSnapshot,
1414
type WidgetCardViewModel as WidgetCardViewModelInterface,
1515
WidgetCardView,
16-
} from "../../../shared-components/right-panel/WidgetCardView/WidgetCardView";
16+
} from "../../../../packages/shared-components/src/right-panel/WidgetCardView/WidgetCardView";
1717
import WidgetUtils, { useWidgets } from "../../../utils/WidgetUtils";
1818
import RightPanelStore from "../../../stores/right-panel/RightPanelStore";
1919
import { Container, WidgetLayoutStore } from "../../../stores/widgets/WidgetLayoutStore";

0 commit comments

Comments
 (0)