Fix missing Storybook autodocs descriptions for shared components (#33135)
This commit is contained in:
+4
-1
@@ -18,10 +18,11 @@ import {
|
|||||||
} from "./UrlPreviewGroupView";
|
} from "./UrlPreviewGroupView";
|
||||||
import { useMockedViewModel } from "../../core/viewmodel";
|
import { useMockedViewModel } from "../../core/viewmodel";
|
||||||
import { LinkedTextContext } from "../../core/utils/LinkedText";
|
import { LinkedTextContext } from "../../core/utils/LinkedText";
|
||||||
|
import { withViewDocs } from "../../../.storybook/withViewDocs";
|
||||||
|
|
||||||
type UrlPreviewGroupViewProps = UrlPreviewGroupViewSnapshot & UrlPreviewGroupViewActions;
|
type UrlPreviewGroupViewProps = UrlPreviewGroupViewSnapshot & UrlPreviewGroupViewActions;
|
||||||
|
|
||||||
const UrlPreviewGroupViewWrapper = ({
|
const UrlPreviewGroupViewWrapperImpl = ({
|
||||||
onHideClick,
|
onHideClick,
|
||||||
onImageClick,
|
onImageClick,
|
||||||
onTogglePreviewLimit,
|
onTogglePreviewLimit,
|
||||||
@@ -39,6 +40,8 @@ const UrlPreviewGroupViewWrapper = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const UrlPreviewGroupViewWrapper = withViewDocs(UrlPreviewGroupViewWrapperImpl, UrlPreviewGroupView);
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
title: "Event/UrlPreviewGroupView",
|
title: "Event/UrlPreviewGroupView",
|
||||||
component: UrlPreviewGroupViewWrapper,
|
component: UrlPreviewGroupViewWrapper,
|
||||||
|
|||||||
+4
-1
@@ -37,7 +37,10 @@ export interface UrlPreviewGroupViewActions {
|
|||||||
export type UrlPreviewGroupViewModel = ViewModel<UrlPreviewGroupViewSnapshot, UrlPreviewGroupViewActions>;
|
export type UrlPreviewGroupViewModel = ViewModel<UrlPreviewGroupViewSnapshot, UrlPreviewGroupViewActions>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UrlPreviewGroupView renders a list of URL previews for a single event.
|
* Renders the URL preview group attached to a single event.
|
||||||
|
*
|
||||||
|
* The view lays out one or more link previews, can collapse or expand
|
||||||
|
* overflowed previews, and exposes a control to hide the group.
|
||||||
*/
|
*/
|
||||||
export function UrlPreviewGroupView({ vm }: UrlPreviewGroupViewProps): JSX.Element | null {
|
export function UrlPreviewGroupView({ vm }: UrlPreviewGroupViewProps): JSX.Element | null {
|
||||||
const { translate: _t } = useI18n();
|
const { translate: _t } = useI18n();
|
||||||
|
|||||||
+6
@@ -17,6 +17,12 @@ export interface Props {
|
|||||||
vm: ViewModel<TextualEventViewSnapshot>;
|
vm: ViewModel<TextualEventViewSnapshot>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders a plain textual timeline event without message-body decorations.
|
||||||
|
*
|
||||||
|
* This view is used for simple informational timeline entries where the
|
||||||
|
* content is already prepared by the view model.
|
||||||
|
*/
|
||||||
export function TextualEventView({ vm }: Props): JSX.Element {
|
export function TextualEventView({ vm }: Props): JSX.Element {
|
||||||
const snapshot = useViewModel(vm);
|
const snapshot = useViewModel(vm);
|
||||||
return <div className="mx_TextualEvent">{snapshot.content}</div>;
|
return <div className="mx_TextualEvent">{snapshot.content}</div>;
|
||||||
|
|||||||
+6
@@ -127,6 +127,12 @@ interface VideoBodyViewProps {
|
|||||||
children?: PropsWithChildren["children"];
|
children?: PropsWithChildren["children"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders the body of a video message with ready, hidden, loading, and error states.
|
||||||
|
*
|
||||||
|
* The media frame preserves layout while loading and can render
|
||||||
|
* supplemental content such as a file body row after the video.
|
||||||
|
*/
|
||||||
export function VideoBodyView({
|
export function VideoBodyView({
|
||||||
vm,
|
vm,
|
||||||
className,
|
className,
|
||||||
|
|||||||
+6
@@ -42,6 +42,12 @@ interface RedactedBodyViewProps {
|
|||||||
ref?: Ref<HTMLSpanElement>;
|
ref?: Ref<HTMLSpanElement>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders the body for a redacted event.
|
||||||
|
*
|
||||||
|
* The view shows the delete icon with localized redaction text and can
|
||||||
|
* optionally wrap the content in a tooltip for extra context.
|
||||||
|
*/
|
||||||
export function RedactedBodyView({ vm, className, ref }: Readonly<RedactedBodyViewProps>): JSX.Element {
|
export function RedactedBodyView({ vm, className, ref }: Readonly<RedactedBodyViewProps>): JSX.Element {
|
||||||
const { text, tooltip } = useViewModel(vm);
|
const { text, tooltip } = useViewModel(vm);
|
||||||
|
|
||||||
|
|||||||
+7
@@ -143,6 +143,13 @@ function attachBodyRef(body: ReactElement, bodyRef?: TextualBodyContentRef): Rea
|
|||||||
return cloneElement(body as ReactElement<{ ref?: TextualBodyContentRef }>, { ref: bodyRef });
|
return cloneElement(body as ReactElement<{ ref?: TextualBodyContentRef }>, { ref: bodyRef });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders a textual message body for timeline events.
|
||||||
|
*
|
||||||
|
* The view supports text, notice, emote, and caption layouts, optional
|
||||||
|
* link or action wrappers, edited and moderation markers, and appended
|
||||||
|
* URL previews.
|
||||||
|
*/
|
||||||
export function TextualBodyView({
|
export function TextualBodyView({
|
||||||
vm,
|
vm,
|
||||||
body,
|
body,
|
||||||
|
|||||||
+4
-1
@@ -11,6 +11,7 @@ import { fn } from "storybook/test";
|
|||||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||||
import { ReactionsRowButtonView } from "../ReactionsRowButton";
|
import { ReactionsRowButtonView } from "../ReactionsRowButton";
|
||||||
import { useMockedViewModel } from "../../../../../core/viewmodel";
|
import { useMockedViewModel } from "../../../../../core/viewmodel";
|
||||||
|
import { withViewDocs } from "../../../../../../.storybook/withViewDocs";
|
||||||
import { ReactionsRowView, type ReactionsRowViewActions, type ReactionsRowViewSnapshot } from "./ReactionsRowView";
|
import { ReactionsRowView, type ReactionsRowViewActions, type ReactionsRowViewSnapshot } from "./ReactionsRowView";
|
||||||
|
|
||||||
interface MockReactionButtonProps {
|
interface MockReactionButtonProps {
|
||||||
@@ -56,7 +57,7 @@ const DefaultReactionButtons = (): JSX.Element => (
|
|||||||
|
|
||||||
type WrapperProps = ReactionsRowViewSnapshot & Partial<ReactionsRowViewActions>;
|
type WrapperProps = ReactionsRowViewSnapshot & Partial<ReactionsRowViewActions>;
|
||||||
|
|
||||||
const ReactionsRowViewWrapper = ({
|
const ReactionsRowViewWrapperImpl = ({
|
||||||
onShowAllClick,
|
onShowAllClick,
|
||||||
onAddReactionClick,
|
onAddReactionClick,
|
||||||
onAddReactionContextMenu,
|
onAddReactionContextMenu,
|
||||||
@@ -77,6 +78,8 @@ const ReactionsRowViewWrapper = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const ReactionsRowViewWrapper = withViewDocs(ReactionsRowViewWrapperImpl, ReactionsRowView);
|
||||||
|
|
||||||
const meta = {
|
const meta = {
|
||||||
title: "MessageBody/ReactionsRow",
|
title: "MessageBody/ReactionsRow",
|
||||||
component: ReactionsRowViewWrapper,
|
component: ReactionsRowViewWrapper,
|
||||||
|
|||||||
+6
@@ -81,6 +81,12 @@ interface ReactionsRowViewProps {
|
|||||||
children?: PropsWithChildren["children"];
|
children?: PropsWithChildren["children"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders the reactions toolbar for an event tile.
|
||||||
|
*
|
||||||
|
* The row can show individual reaction buttons, an optional "show all"
|
||||||
|
* control, and the add-reaction affordance.
|
||||||
|
*/
|
||||||
export function ReactionsRowView({ vm, className, children }: Readonly<ReactionsRowViewProps>): JSX.Element {
|
export function ReactionsRowView({ vm, className, children }: Readonly<ReactionsRowViewProps>): JSX.Element {
|
||||||
const {
|
const {
|
||||||
ariaLabel,
|
ariaLabel,
|
||||||
|
|||||||
+4
-1
@@ -10,6 +10,7 @@ import { fn } from "storybook/test";
|
|||||||
|
|
||||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||||
import { useMockedViewModel } from "../../../../../core/viewmodel";
|
import { useMockedViewModel } from "../../../../../core/viewmodel";
|
||||||
|
import { withViewDocs } from "../../../../../../.storybook/withViewDocs";
|
||||||
import { type ReactionsRowButtonTooltipViewSnapshot } from "../ReactionsRowButtonTooltip";
|
import { type ReactionsRowButtonTooltipViewSnapshot } from "../ReactionsRowButtonTooltip";
|
||||||
import {
|
import {
|
||||||
ReactionsRowButtonView,
|
ReactionsRowButtonView,
|
||||||
@@ -25,7 +26,7 @@ type WrapperProps = Omit<ReactionsRowButtonViewSnapshot, "tooltipVm"> &
|
|||||||
tooltipOpen?: ReactionsRowButtonTooltipViewSnapshot["tooltipOpen"];
|
tooltipOpen?: ReactionsRowButtonTooltipViewSnapshot["tooltipOpen"];
|
||||||
};
|
};
|
||||||
|
|
||||||
const ReactionsRowButtonViewWrapper = ({
|
const ReactionsRowButtonViewWrapperImpl = ({
|
||||||
tooltipFormattedSenders,
|
tooltipFormattedSenders,
|
||||||
tooltipCaption,
|
tooltipCaption,
|
||||||
tooltipOpen,
|
tooltipOpen,
|
||||||
@@ -54,6 +55,8 @@ const ReactionsRowButtonViewWrapper = ({
|
|||||||
return <ReactionsRowButtonView vm={vm} />;
|
return <ReactionsRowButtonView vm={vm} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const ReactionsRowButtonViewWrapper = withViewDocs(ReactionsRowButtonViewWrapperImpl, ReactionsRowButtonView);
|
||||||
|
|
||||||
const meta = {
|
const meta = {
|
||||||
title: "MessageBody/ReactionsRowButton",
|
title: "MessageBody/ReactionsRowButton",
|
||||||
component: ReactionsRowButtonViewWrapper,
|
component: ReactionsRowButtonViewWrapper,
|
||||||
|
|||||||
+4
-1
@@ -64,7 +64,10 @@ interface ReactionsRowButtonViewProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders the reaction button in a reactions row.
|
* Renders a single reaction button within a reactions row.
|
||||||
|
*
|
||||||
|
* The button supports text or image reactions, selected and disabled
|
||||||
|
* styling, and wraps its content in the reactions tooltip view.
|
||||||
*/
|
*/
|
||||||
export function ReactionsRowButtonView({ vm }: Readonly<ReactionsRowButtonViewProps>): JSX.Element {
|
export function ReactionsRowButtonView({ vm }: Readonly<ReactionsRowButtonViewProps>): JSX.Element {
|
||||||
const snapshot = useViewModel(vm) as ReactionsRowButtonViewSnapshot & { ariaLabel?: string };
|
const snapshot = useViewModel(vm) as ReactionsRowButtonViewSnapshot & { ariaLabel?: string };
|
||||||
|
|||||||
Reference in New Issue
Block a user