From 0993b43c7969abd66dff283945de5d8326758545 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 5 Mar 2022 14:43:43 +0100 Subject: [PATCH] Created namespace for form controls --- src/domains/helpers/EditDomainRedirectsModal.tsx | 2 +- src/servers/helpers/ServerForm.tsx | 2 +- src/settings/RealTimeUpdatesSettings.tsx | 2 +- src/settings/ShortUrlCreationSettings.tsx | 2 +- src/settings/TagsSettings.tsx | 2 +- src/utils/{ => forms}/FormGroupContainer.tsx | 4 +--- src/utils/{ => forms}/FormText.tsx | 0 test/settings/ShortUrlCreationSettings.test.tsx | 2 +- 8 files changed, 7 insertions(+), 9 deletions(-) rename src/utils/{ => forms}/FormGroupContainer.tsx (89%) rename src/utils/{ => forms}/FormText.tsx (100%) diff --git a/src/domains/helpers/EditDomainRedirectsModal.tsx b/src/domains/helpers/EditDomainRedirectsModal.tsx index 2692607c..116ed8f3 100644 --- a/src/domains/helpers/EditDomainRedirectsModal.tsx +++ b/src/domains/helpers/EditDomainRedirectsModal.tsx @@ -1,7 +1,7 @@ import { FC, useState } from 'react'; import { Button, Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap'; import { ShlinkDomain, ShlinkDomainRedirects } from '../../api/types'; -import { FormGroupContainer, FormGroupContainerProps } from '../../utils/FormGroupContainer'; +import { FormGroupContainer, FormGroupContainerProps } from '../../utils/forms/FormGroupContainer'; import { handleEventPreventingDefault, nonEmptyValueOrNull } from '../../utils/utils'; import { InfoTooltip } from '../../utils/InfoTooltip'; diff --git a/src/servers/helpers/ServerForm.tsx b/src/servers/helpers/ServerForm.tsx index 578df664..e7ae51e7 100644 --- a/src/servers/helpers/ServerForm.tsx +++ b/src/servers/helpers/ServerForm.tsx @@ -1,5 +1,5 @@ import { FC, ReactNode, useEffect, useState } from 'react'; -import { FormGroupContainer, FormGroupContainerProps } from '../../utils/FormGroupContainer'; +import { FormGroupContainer, FormGroupContainerProps } from '../../utils/forms/FormGroupContainer'; import { handleEventPreventingDefault } from '../../utils/utils'; import { ServerData } from '../data'; import { SimpleCard } from '../../utils/SimpleCard'; diff --git a/src/settings/RealTimeUpdatesSettings.tsx b/src/settings/RealTimeUpdatesSettings.tsx index d2e5a452..c9179036 100644 --- a/src/settings/RealTimeUpdatesSettings.tsx +++ b/src/settings/RealTimeUpdatesSettings.tsx @@ -2,7 +2,7 @@ import { FormGroup, Input } from 'reactstrap'; import classNames from 'classnames'; import ToggleSwitch from '../utils/ToggleSwitch'; import { SimpleCard } from '../utils/SimpleCard'; -import { FormText } from '../utils/FormText'; +import { FormText } from '../utils/forms/FormText'; import { Settings } from './reducers/settings'; interface RealTimeUpdatesProps { diff --git a/src/settings/ShortUrlCreationSettings.tsx b/src/settings/ShortUrlCreationSettings.tsx index e3c093d9..902d3487 100644 --- a/src/settings/ShortUrlCreationSettings.tsx +++ b/src/settings/ShortUrlCreationSettings.tsx @@ -3,7 +3,7 @@ import { DropdownItem, FormGroup } from 'reactstrap'; import { SimpleCard } from '../utils/SimpleCard'; import ToggleSwitch from '../utils/ToggleSwitch'; import { DropdownBtn } from '../utils/DropdownBtn'; -import { FormText } from '../utils/FormText'; +import { FormText } from '../utils/forms/FormText'; import { Settings, ShortUrlCreationSettings as ShortUrlsSettings, TagFilteringMode } from './reducers/settings'; interface ShortUrlCreationProps { diff --git a/src/settings/TagsSettings.tsx b/src/settings/TagsSettings.tsx index 2291798a..8575be07 100644 --- a/src/settings/TagsSettings.tsx +++ b/src/settings/TagsSettings.tsx @@ -5,7 +5,7 @@ import { TagsModeDropdown } from '../tags/TagsModeDropdown'; import { capitalize } from '../utils/utils'; import { OrderingDropdown } from '../utils/OrderingDropdown'; import { TAGS_ORDERABLE_FIELDS } from '../tags/data/TagsListChildrenProps'; -import { FormText } from '../utils/FormText'; +import { FormText } from '../utils/forms/FormText'; import { Settings, TagsSettings as TagsSettingsOptions } from './reducers/settings'; interface TagsProps { diff --git a/src/utils/FormGroupContainer.tsx b/src/utils/forms/FormGroupContainer.tsx similarity index 89% rename from src/utils/FormGroupContainer.tsx rename to src/utils/forms/FormGroupContainer.tsx index 874101fa..b4bedd40 100644 --- a/src/utils/FormGroupContainer.tsx +++ b/src/utils/forms/FormGroupContainer.tsx @@ -21,9 +21,7 @@ export const FormGroupContainer: FC = ( return ( - + {children && }