Files
Homarr/src/components/Dashboard/Modals/EditService/Tabs/GeneralTab/GeneralTab.tsx

49 lines
1.6 KiB
TypeScript
Raw Normal View History

import { Group, Tabs, Text, TextInput } from '@mantine/core';
2022-12-04 21:19:40 +01:00
import { UseFormReturnType } from '@mantine/form';
import { IconCursorText, IconLink } from '@tabler/icons';
import { useTranslation } from 'next-i18next';
import { ServiceType } from '../../../../../../types/service';
import { EditServiceModalTab } from '../type';
2022-12-04 21:19:40 +01:00
interface GeneralTabProps {
form: UseFormReturnType<ServiceType, (values: ServiceType) => ServiceType>;
openTab: (tab: EditServiceModalTab) => void;
2022-12-04 21:19:40 +01:00
}
export const GeneralTab = ({ form, openTab }: GeneralTabProps) => {
2022-12-04 21:19:40 +01:00
const { t } = useTranslation('');
return (
<Tabs.Panel value="general" pt="lg">
<TextInput
icon={<IconCursorText size={16} />}
label="Service name"
description="Used for displaying the service on the dashboard"
2022-12-04 21:19:40 +01:00
placeholder="My example service"
variant="default"
mb="md"
withAsterisk
2022-12-04 21:19:40 +01:00
{...form.getInputProps('name')}
/>
<TextInput
icon={<IconLink size={16} />}
label="Service url"
description={
<Group spacing={3}>
<Text>
URL that will be opened when clicking on the service. Can be overwritten using
</Text>
<Text onClick={() => openTab('behaviour')} variant="link">
on click URL
</Text>
<Text>when using external URLs to enhance security.</Text>
</Group>
}
2022-12-04 21:19:40 +01:00
placeholder="https://google.com"
variant="default"
withAsterisk
2022-12-04 21:19:40 +01:00
{...form.getInputProps('url')}
/>
</Tabs.Panel>
);
};