* start hide * Move useSettingsValueWithSetter to useSettings * Add new setting showMediaEventIds * Add a migration path * Add an action button to hide settings. * Tweaks to MImageBody to support new setting. * Fixup and add tests * add description for migration * docs fixes * add type * i18n * appese prettier * Add tests for HideActionButton * lint * lint * First pass at support for previewing/hiding images. * Add a test for video files. * First pass at supporting hiding video files. * Use a hook for media visibility. * Drop setting hook usage. * Fixup MImageBody test * Fixup tests * Support functional components for message body rendering. * Add a comment * Move props into IProps * Use new wrapping logic * lint * fixup * allow for a delay for the image to render * remove .only * lint * Fix jest test * Fixup tests. * make tests happy * Improve comments * review fixes * unbreak test
25 lines
780 B
TypeScript
25 lines
780 B
TypeScript
/*
|
|
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 PropsWithChildren, type MouseEventHandler } from "react";
|
|
import { VisibilityOnIcon } from "@vector-im/compound-design-tokens/assets/web/icons";
|
|
|
|
interface IProps {
|
|
onClick: MouseEventHandler<HTMLButtonElement>;
|
|
}
|
|
|
|
export const HiddenMediaPlaceholder: React.FunctionComponent<PropsWithChildren<IProps>> = ({ onClick, children }) => {
|
|
return (
|
|
<button onClick={onClick} className="mx_HiddenMediaPlaceholder">
|
|
<div>
|
|
<VisibilityOnIcon />
|
|
<span>{children}</span>
|
|
</div>
|
|
</button>
|
|
);
|
|
};
|