fix(striker-ui): add close button to add peer dialog

main
Tsu-ba-me 1 year ago
parent fce5bc5c11
commit 53f169ad5c
  1. 29
      striker-ui/components/StrikerConfig/AddPeerDialog.tsx

@ -1,4 +1,11 @@
import { forwardRef, useCallback, useMemo, useRef, useState } from 'react'; import {
MutableRefObject,
forwardRef,
useCallback,
useMemo,
useRef,
useState,
} from 'react';
import INPUT_TYPES from '../../lib/consts/INPUT_TYPES'; import INPUT_TYPES from '../../lib/consts/INPUT_TYPES';
@ -11,6 +18,7 @@ import ConfirmDialog from '../ConfirmDialog';
import FlexBox from '../FlexBox'; import FlexBox from '../FlexBox';
import Grid from '../Grid'; import Grid from '../Grid';
import handleAPIError from '../../lib/handleAPIError'; import handleAPIError from '../../lib/handleAPIError';
import IconButton from '../IconButton';
import InputWithRef, { InputForwardedRefContent } from '../InputWithRef'; import InputWithRef, { InputForwardedRefContent } from '../InputWithRef';
import { Message } from '../MessageBox'; import { Message } from '../MessageBox';
import MessageGroup, { MessageGroupForwardedRefContent } from '../MessageGroup'; import MessageGroup, { MessageGroupForwardedRefContent } from '../MessageGroup';
@ -19,7 +27,7 @@ import {
buildIPAddressTestBatch, buildIPAddressTestBatch,
buildPeacefulStringTestBatch, buildPeacefulStringTestBatch,
} from '../../lib/test_input'; } from '../../lib/test_input';
import { BodyText } from '../Text'; import { BodyText, HeaderText } from '../Text';
import useProtect from '../../hooks/useProtect'; import useProtect from '../../hooks/useProtect';
import useProtectedState from '../../hooks/useProtectedState'; import useProtectedState from '../../hooks/useProtectedState';
@ -305,7 +313,22 @@ const AddPeerDialog = forwardRef<
}} }}
proceedButtonProps={{ disabled: isFormInvalid }} proceedButtonProps={{ disabled: isFormInvalid }}
ref={ref} ref={ref}
titleText="Add a peer" titleText={
<>
<HeaderText>Add a peer</HeaderText>
<IconButton
mapPreset="close"
onClick={() => {
if (ref && 'current' in ref) {
(
ref as MutableRefObject<ConfirmDialogForwardedRefContent>
).current.setOpen?.call(null, false);
}
}}
variant="redcontained"
/>
</>
}
/> />
); );
}); });

Loading…
Cancel
Save