2024-06-11 05:16:11 +08:00
|
|
|
import React from 'react';
|
|
|
|
import Styled from './styles';
|
|
|
|
import { GenericSidekickContentProps } from '../types';
|
|
|
|
import GenericContentItem from '../generic-content-item/component';
|
|
|
|
import { PANELS, ACTIONS } from '/imports/ui/components/layout/enums';
|
|
|
|
|
|
|
|
const GenericSidekickContent: React.FC<GenericSidekickContentProps> = ({
|
|
|
|
renderFunction,
|
2024-06-18 20:20:35 +08:00
|
|
|
layoutContextDispatch,
|
2024-06-11 05:16:11 +08:00
|
|
|
genericContentId,
|
|
|
|
genericContentLabel,
|
2024-06-18 20:20:35 +08:00
|
|
|
}) => (
|
|
|
|
<Styled.Container
|
|
|
|
data-test={genericContentId}
|
|
|
|
>
|
|
|
|
<Styled.Header
|
|
|
|
leftButtonProps={{
|
|
|
|
onClick: () => {
|
|
|
|
layoutContextDispatch({
|
|
|
|
type: ACTIONS.SET_SIDEBAR_CONTENT_IS_OPEN,
|
|
|
|
value: false,
|
|
|
|
});
|
|
|
|
layoutContextDispatch({
|
|
|
|
type: ACTIONS.SET_SIDEBAR_CONTENT_PANEL,
|
|
|
|
value: PANELS.NONE,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
'data-test': `hide_${genericContentId}`,
|
|
|
|
'aria-label': genericContentLabel,
|
|
|
|
label: genericContentLabel,
|
|
|
|
}}
|
|
|
|
customRightButton={null}
|
|
|
|
/>
|
|
|
|
<GenericContentItem
|
|
|
|
key={genericContentId}
|
|
|
|
renderFunction={renderFunction}
|
|
|
|
/>
|
|
|
|
</Styled.Container>
|
|
|
|
);
|
2024-06-11 05:16:11 +08:00
|
|
|
|
2024-06-14 06:30:59 +08:00
|
|
|
export default GenericSidekickContent;
|