misc_pterodactyl-panel/resources/scripts/components/admin/servers/settings/BaseSettingsBox.tsx
2021-10-24 16:05:00 -06:00

24 lines
1.1 KiB
TypeScript

import React, { ReactNode } from 'react';
import tw from 'twin.macro';
import { useFormikContext } from 'formik';
import AdminBox from '@/components/admin/AdminBox';
import { faCogs } from '@fortawesome/free-solid-svg-icons';
import Field from '@/components/elements/Field';
import OwnerSelect from '@/components/admin/servers/OwnerSelect';
import { useServerFromRoute } from '@/api/admin/server';
export default ({ children }: { children?: ReactNode }) => {
const { data: server } = useServerFromRoute();
const { isSubmitting } = useFormikContext();
return (
<AdminBox icon={faCogs} title={'Settings'} isLoading={isSubmitting}>
<div css={tw`grid grid-cols-1 xl:grid-cols-2 gap-4 lg:gap-6`}>
<Field id={'name'} name={'name'} label={'Server Name'} type={'text'} placeholder={'My Amazing Server'}/>
<Field id={'externalId'} name={'externalId'} label={'External Identifier'} type={'text'}/>
<OwnerSelect selected={server?.relationships.user}/>
{children}
</div>
</AdminBox>
);
};