1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-06 00:07:44 +01:00
unleash.unleash/frontend/src/component/common/InstanceStatus/InstanceStatus.tsx

23 lines
834 B
TypeScript
Raw Normal View History

import { useInstanceStatus } from 'hooks/api/getters/useInstanceStatus/useInstanceStatus';
import React, { FC } from 'react';
import { InstanceStatusBar } from 'component/common/InstanceStatus/InstanceStatusBar';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
export const InstanceStatus: FC = ({ children }) => {
const { instanceStatus } = useInstanceStatus();
return (
<div hidden={!instanceStatus} style={{ height: '100%' }}>
<ConditionallyRender
condition={Boolean(instanceStatus)}
show={() => (
<InstanceStatusBarMemo instanceStatus={instanceStatus!} />
)}
/>
{children}
</div>
);
};
const InstanceStatusBarMemo = React.memo(InstanceStatusBar);