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

26 lines
769 B
TypeScript
Raw Normal View History

2022-10-23 01:39:02 +01:00
import { getAssetIDByName } from "@ui/assets";
import { showToast } from "@ui/toasts";
2022-10-19 07:58:32 +01:00
import { Forms } from "@ui/components";
2022-10-23 01:39:02 +01:00
import copyText from "@utils/copyText";
interface VersionProps {
label: string;
2022-10-23 01:39:02 +01:00
version: string;
icon: string;
}
2022-10-19 07:58:32 +01:00
const { FormRow, FormText } = Forms;
2022-10-23 01:39:02 +01:00
export default function Version({ label, version, icon }: VersionProps) {
return (
<FormRow
label={label}
2022-10-23 01:39:02 +01:00
leading={() => <FormRow.Icon source={getAssetIDByName(icon)} />}
trailing={() => <FormText>{version}</FormText>}
2022-10-23 01:39:02 +01:00
onPress={() => {
copyText(`${label} - ${version}`);
showToast("Copied version to clipboard.", getAssetIDByName("toast_copy_link"));
2022-10-23 01:39:02 +01:00
}}
/>
)
}