GoonCord/src/core/ui/components/Version.tsx

26 lines
776 B
TypeScript
Raw Normal View History

2024-03-06 01:57:59 +08:00
import { getAssetIDByName } from "@lib/api/assets";
import { FormText } from "@lib/ui/components/discord/Forms";
import { TableRow } from "@lib/ui/components/discord/Redesign";
import { clipboard } from "@metro/common";
2024-03-06 01:57:59 +08:00
import { showToast } from "@ui/toasts";
interface VersionProps {
label: string;
2022-10-23 01:39:02 +01:00
version: string;
icon: string;
}
2024-03-09 05:29:40 +08:00
export default function Version({ label, version, icon }: VersionProps) {
2024-03-06 01:57:59 +08:00
return (
2023-12-21 03:30:21 +08:00
<TableRow
label={label}
2023-12-21 03:30:21 +08:00
icon={<TableRow.Icon source={getAssetIDByName(icon)} />}
2023-01-14 02:41:28 +00:00
trailing={<FormText>{version}</FormText>}
2022-10-23 01:39:02 +01:00
onPress={() => {
clipboard.setString(`${label} - ${version}`);
2023-12-21 12:45:15 +08:00
showToast.showCopyToClipboard();
2022-10-23 01:39:02 +01:00
}}
/>
2024-03-06 01:57:59 +08:00
);
}