From 40febdae87518dac186146b269008922f0cd5c5c Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Wed, 15 Feb 2023 16:55:47 -0500 Subject: [PATCH] fix(striker-ui): allow string header in ExpandablePanel --- striker-ui/components/Panels/ExpandablePanel.tsx | 7 ++++++- striker-ui/components/StrikerConfig/ConfigPeersForm.tsx | 5 +---- .../components/StrikerConfig/ManageChangedSSHKeysForm.tsx | 5 +---- striker-ui/components/StrikerConfig/ManageUsersForm.tsx | 5 +---- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/striker-ui/components/Panels/ExpandablePanel.tsx b/striker-ui/components/Panels/ExpandablePanel.tsx index 63fd0bcf..d64e6f97 100644 --- a/striker-ui/components/Panels/ExpandablePanel.tsx +++ b/striker-ui/components/Panels/ExpandablePanel.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 = ({ [isExpand], ); const contentHeight = useMemo(() => (isExpand ? 'auto' : '.2em'), [isExpand]); + const headerElement = useMemo( + () => (typeof header === 'string' ? {header} : header), + [header], + ); const headerSpinner = useMemo( () => isShowHeaderSpinner && !isExpand && isLoading ? ( @@ -74,7 +79,7 @@ const ExpandablePanel: FC = ({ - {header} + {headerElement} {headerSpinner} = ({ return ( <> - Configure striker peers} - loading={isLoading} - > + = ({ return ( <> - Manage changed SSH keys} - loading={isLoading} - > + The identity of the following targets have unexpectedly changed. diff --git a/striker-ui/components/StrikerConfig/ManageUsersForm.tsx b/striker-ui/components/StrikerConfig/ManageUsersForm.tsx index 4af37416..a861b3e4 100644 --- a/striker-ui/components/StrikerConfig/ManageUsersForm.tsx +++ b/striker-ui/components/StrikerConfig/ManageUsersForm.tsx @@ -36,10 +36,7 @@ const ManageUsersForm: FC = () => { }, [setListMessage, setUsers, users]); return ( - Manage users} - loading={!users} - > + }