fix(striker-ui): add EditFenceInputGroup

main
Tsu-ba-me 2 years ago committed by digimer
parent 7628f54c4c
commit 5c4539f06c
  1. 37
      striker-ui/components/EditFenceInputGroup.tsx
  2. 12
      striker-ui/types/EditFenceInputGroup.d.ts

@ -0,0 +1,37 @@
import { FC, useMemo } from 'react';
import CommonFenceInputGroup from './CommonFenceInputGroup';
import Spinner from './Spinner';
const EditFenceInputGroup: FC<EditFenceInputGroupProps> = ({
fenceId,
fenceTemplate: externalFenceTemplate,
loading: isExternalLoading,
previousFenceName,
previousFenceParameters,
}) => {
const content = useMemo(
() =>
isExternalLoading ? (
<Spinner />
) : (
<CommonFenceInputGroup
fenceId={fenceId}
fenceTemplate={externalFenceTemplate}
previousFenceName={previousFenceName}
previousFenceParameters={previousFenceParameters}
/>
),
[
externalFenceTemplate,
fenceId,
isExternalLoading,
previousFenceName,
previousFenceParameters,
],
);
return <>{content}</>;
};
export default EditFenceInputGroup;

@ -0,0 +1,12 @@
type EditFenceInputGroupOptionalProps = {
fenceTemplate?: APIFenceTemplate;
loading?: boolean;
};
type EditFenceInputGroupProps = EditFenceInputGroupOptionalProps &
Required<
Pick<
CommonFenceInputGroupProps,
'fenceId' | 'previousFenceName' | 'previousFenceParameters'
>
>;
Loading…
Cancel
Save