refactor: wrap InstallForm in ScrollArea component

This commit is contained in:
Nicolas Meienberger 2023-10-26 08:48:17 +02:00 committed by Nicolas Meienberger
parent ac6f54312d
commit 6341140e9d
2 changed files with 12 additions and 6 deletions

View file

@ -2,6 +2,7 @@ import React from 'react';
import { Dialog, DialogContent, DialogDescription, DialogHeader } from '@/components/ui/Dialog';
import { useTranslations } from 'next-intl';
import { AppInfo } from '@runtipi/shared';
import { ScrollArea } from '@/components/ui/ScrollArea';
import { InstallForm, FormValues } from '../InstallForm';
interface IProps {
@ -20,9 +21,11 @@ export const InstallModal: React.FC<IProps> = ({ info, isOpen, onClose, onSubmit
<DialogHeader>
<h5 className="modal-title">{t('title', { name: info.name })}</h5>
</DialogHeader>
<DialogDescription>
<InstallForm onSubmit={onSubmit} formFields={info.form_fields} info={info} />
</DialogDescription>
<ScrollArea maxHeight={500}>
<DialogDescription>
<InstallForm onSubmit={onSubmit} formFields={info.form_fields} info={info} />
</DialogDescription>
</ScrollArea>
</DialogContent>
</Dialog>
);

View file

@ -2,6 +2,7 @@ import React from 'react';
import { Dialog, DialogContent, DialogDescription, DialogHeader } from '@/components/ui/Dialog';
import { useTranslations } from 'next-intl';
import { AppInfo } from '@runtipi/shared';
import { ScrollArea } from '@/components/ui/ScrollArea';
import { InstallForm, type FormValues } from '../InstallForm';
interface IProps {
@ -23,9 +24,11 @@ export const UpdateSettingsModal: React.FC<IProps> = ({ info, config, isOpen, on
<DialogHeader>
<h5 className="modal-title">{t('title', { name: info.name })}</h5>
</DialogHeader>
<DialogDescription>
<InstallForm onSubmit={onSubmit} formFields={info.form_fields} info={info} initalValues={{ ...config, exposed, domain }} />
</DialogDescription>
<ScrollArea maxHeight={500}>
<DialogDescription>
<InstallForm onSubmit={onSubmit} formFields={info.form_fields} info={info} initalValues={{ ...config, exposed, domain }} />
</DialogDescription>
</ScrollArea>
</DialogContent>
</Dialog>
);