Skip to content

Commit

Permalink
fix(diff): Fix history diff - refs #159677
Browse files Browse the repository at this point in the history
  • Loading branch information
avoinea committed Jan 31, 2023
1 parent 6e3e725 commit 0188cf4
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/components/manage/Blocks/Title/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,27 @@ import PropTypes from 'prop-types';

import BannerView from '@eeacms/volto-eea-website-theme/components/theme/Banner/View';

function IsomorphicPortal({ children }) {
const [isClient, setIsClient] = React.useState();
React.useEffect(() => setIsClient(true), []);

return isClient ? (
<Portal node={document.getElementById('page-header')}>{children}</Portal>
) : (
children
);
}

/**
* View title block class.
* @class View
* @extends Component
*/
const View = (props) => {
if (__SERVER__) return <BannerView {...props} />;
return (
<Portal node={document.getElementById('page-header')}>
<BannerView {...props} />
</Portal>
);
};
const View = (props) => (
<IsomorphicPortal>
<BannerView {...props} />
</IsomorphicPortal>
);

/**
* Property types.
Expand Down

0 comments on commit 0188cf4

Please sign in to comment.