bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/generic-content/generic-sidekick-content/component.tsx
Arthurk12 a1dee317f3 feat(generic-content): add sidekick type
Adds 'sidekick' type of generic content. This type allows rendering
generic content in the sidekick panel, in addition to the existing 'main'
type, which renders generic content over the presentation area.
Each generic sidekick content set through plugins is automatically
associated with a button in the navigation bar to toggle its panel.
2024-06-10 19:36:51 -03:00

45 lines
1.3 KiB
TypeScript

import React from 'react';
import Styled from './styles';
import { GenericSidekickContentProps } from '../types';
import GenericContentItem from '../generic-content-item/component';
import { layoutDispatch } from '/imports/ui/components/layout/context';
import { PANELS, ACTIONS } from '/imports/ui/components/layout/enums';
const GenericSidekickContent: React.FC<GenericSidekickContentProps> = ({
renderFunction,
genericContentId,
genericContentLabel,
}) => {
const layoutContextDispatch = layoutDispatch();
return (
<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>
);
};
export default GenericSidekickContent;