fix(striker-ui): allow string header in ExpandablePanel

main
Tsu-ba-me 2 years ago
parent 182837c93b
commit 40febdae87
  1. 7
      striker-ui/components/Panels/ExpandablePanel.tsx
  2. 5
      striker-ui/components/StrikerConfig/ConfigPeersForm.tsx
  3. 5
      striker-ui/components/StrikerConfig/ManageChangedSSHKeysForm.tsx
  4. 5
      striker-ui/components/StrikerConfig/ManageUsersForm.tsx

@ -12,6 +12,7 @@ import InnerPanel from './InnerPanel';
import InnerPanelBody from './InnerPanelBody';
import InnerPanelHeader from './InnerPanelHeader';
import Spinner from '../Spinner';
import { BodyText } from '../Text';
type ExpandablePanelOptionalProps = {
expandInitially?: boolean;
@ -46,6 +47,10 @@ const ExpandablePanel: FC<ExpandablePanelProps> = ({
[isExpand],
);
const contentHeight = useMemo(() => (isExpand ? 'auto' : '.2em'), [isExpand]);
const headerElement = useMemo(
() => (typeof header === 'string' ? <BodyText>{header}</BodyText> : header),
[header],
);
const headerSpinner = useMemo(
() =>
isShowHeaderSpinner && !isExpand && isLoading ? (
@ -74,7 +79,7 @@ const ExpandablePanel: FC<ExpandablePanelProps> = ({
<InnerPanel>
<InnerPanelHeader>
<FlexBox row>
{header}
{headerElement}
{headerSpinner}
</FlexBox>
<IconButton

@ -127,10 +127,7 @@ const ConfigPeersForm: FC<ConfigPeerFormProps> = ({
return (
<>
<ExpandablePanel
header={<BodyText>Configure striker peers</BodyText>}
loading={isLoading}
>
<ExpandablePanel header="Configure striker peers" loading={isLoading}>
<Grid columns={{ xs: 1, sm: 2 }} container spacing="1em">
<Grid item xs={1}>
<List

@ -85,10 +85,7 @@ const ManageChangedSSHKeysForm: FC<ManageChangedSSHKeysFormProps> = ({
return (
<>
<ExpandablePanel
header={<BodyText>Manage changed SSH keys</BodyText>}
loading={isLoading}
>
<ExpandablePanel header="Manage changed SSH keys" loading={isLoading}>
<FlexBox spacing=".2em">
<BodyText>
The identity of the following targets have unexpectedly changed.

@ -36,10 +36,7 @@ const ManageUsersForm: FC = () => {
}, [setListMessage, setUsers, users]);
return (
<ExpandablePanel
header={<BodyText>Manage users</BodyText>}
loading={!users}
>
<ExpandablePanel header="Manage users" loading={!users}>
<List
allowEdit={false}
listEmpty={<MessageBox {...listMessage} />}

Loading…
Cancel
Save