2022-10-26 11:04:16 +02:00
|
|
|
/*
|
2024-09-09 14:57:16 +01:00
|
|
|
Copyright 2024 New Vector Ltd.
|
2022-10-26 11:04:16 +02:00
|
|
|
Copyright 2022 The Matrix.org Foundation C.I.C.
|
|
|
|
|
|
2025-01-06 11:18:54 +00:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
2024-09-09 14:57:16 +01:00
|
|
|
Please see LICENSE files in the repository root for full details.
|
2022-10-26 11:04:16 +02:00
|
|
|
*/
|
|
|
|
|
|
2024-06-25 16:59:07 +01:00
|
|
|
import React from "react";
|
2022-10-26 11:04:16 +02:00
|
|
|
|
|
|
|
|
import { _t } from "../../../languageHandler";
|
|
|
|
|
import Modal from "../../../Modal";
|
|
|
|
|
import InfoDialog from "../dialogs/InfoDialog";
|
2024-06-25 16:59:07 +01:00
|
|
|
import AccessibleButton, { ButtonProps } from "./AccessibleButton";
|
2022-10-26 11:04:16 +02:00
|
|
|
|
2024-06-25 16:59:07 +01:00
|
|
|
type Props = Omit<ButtonProps<"div">, "element" | "kind" | "onClick" | "className"> & {
|
2022-10-26 11:04:16 +02:00
|
|
|
title: string;
|
|
|
|
|
description: string | React.ReactNode;
|
2023-12-20 14:42:31 +00:00
|
|
|
};
|
2022-10-26 11:04:16 +02:00
|
|
|
|
2023-12-20 14:42:31 +00:00
|
|
|
const LearnMore: React.FC<Props> = ({ title, description, ...rest }) => {
|
2023-01-12 13:25:14 +00:00
|
|
|
const onClick = (): void => {
|
2022-10-26 11:04:16 +02:00
|
|
|
Modal.createDialog(InfoDialog, {
|
|
|
|
|
title,
|
|
|
|
|
description,
|
2023-08-23 11:57:22 +01:00
|
|
|
button: _t("action|got_it"),
|
2022-10-26 11:04:16 +02:00
|
|
|
hasCloseButton: true,
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<AccessibleButton {...rest} kind="link_inline" onClick={onClick} className="mx_LearnMore_button">
|
2023-08-22 20:55:15 +01:00
|
|
|
{_t("action|learn_more")}
|
2022-10-26 11:04:16 +02:00
|
|
|
</AccessibleButton>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default LearnMore;
|