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

55 lines
1.6 KiB
TypeScript
Raw Normal View History

import { 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={
2022-12-11 00:03:28 +09:00
<Text>
URL that will be opened when clicking on the service. Can be overwritten using
<Text
onClick={() => openTab('behaviour')}
variant="link"
span
style={{
cursor: 'pointer',
}}
>
{' '}
on click URL{' '}
</Text>
2022-12-11 00:03:28 +09:00
when using external URLs to enhance security.
</Text>
}
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>
);
};