ui(admin): start work on LocationSelect.tsx

This commit is contained in:
Matthew Penner 2021-01-31 15:59:37 -07:00
parent 1c8143ad9d
commit 7bbe9e8e89
5 changed files with 160 additions and 28 deletions

View file

@ -1,3 +1,4 @@
import LocationSelect from '@/components/admin/nodes/LocationSelect';
import React from 'react';
import AdminBox from '@/components/admin/AdminBox';
import tw from 'twin.macro';
@ -12,8 +13,11 @@ import { ApplicationStore } from '@/state';
import { Actions, useStoreActions } from 'easy-peasy';
interface Values {
public: boolean;
name: string;
description: string;
locationId: number;
fqdn: string;
}
export default () => {
@ -44,8 +48,11 @@ export default () => {
<Formik
onSubmit={submit}
initialValues={{
public: node.public,
name: node.name,
description: node.description || '',
locationId: node.locationId,
fqdn: node.fqdn,
}}
validationSchema={object().shape({
name: string().required().max(191),
@ -77,6 +84,19 @@ export default () => {
/>
</div>
<div css={tw`mb-6`}>
<LocationSelect defaultLocation={{ id: 1, short: 'local', long: '', createdAt: new Date(), updatedAt: new Date() }}/>
</div>
<div css={tw`mb-6`}>
<Field
id={'fqdn'}
name={'fqdn'}
label={'FQDN'}
type={'text'}
/>
</div>
<div css={tw`w-full flex flex-row items-center`}>
<div css={tw`flex ml-auto`}>
<Button type={'submit'} disabled={isSubmitting || !isValid}>