95d823951f
Renames the generic component to generic content and adds the first type, called 'main'. This commit is a preparation to allow generic content from plugins to have types.
27 lines
539 B
TypeScript
27 lines
539 B
TypeScript
import React, { useEffect, useRef } from 'react';
|
|
import { GenericContentItemProps } from './types';
|
|
|
|
const GenericContentItem: React.FC<GenericContentItemProps> = (props) => {
|
|
const {
|
|
renderFunction,
|
|
} = props;
|
|
const elementRef = useRef(null);
|
|
|
|
useEffect(() => {
|
|
if (elementRef.current && renderFunction) {
|
|
renderFunction(elementRef.current);
|
|
}
|
|
}, [elementRef]);
|
|
|
|
return (
|
|
<div
|
|
style={{
|
|
overflow: 'hidden',
|
|
}}
|
|
ref={elementRef}
|
|
/>
|
|
);
|
|
};
|
|
|
|
export default GenericContentItem;
|