How to use the @plone/volto/helpers.hasBlocksData function in @plone/volto

To help you get started, we’ve selected a few @plone/volto examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github plone / volto / src / components / theme / View / DefaultView.jsx View on Github external
const DefaultView = ({ content, intl }) => {
  const blocksFieldname = getBlocksFieldname(content);
  const blocksLayoutFieldname = getBlocksLayoutFieldname(content);

  return hasBlocksData(content) ? (
    <div id="page-document">
      
      {map(content[blocksLayoutFieldname].items, block =&gt; {
        const Block =
          blocks.blocksConfig[(content[blocksFieldname]?.[block]?.['@type'])]?.[
            'view'
          ] || null;
        return Block !== null ? (
          
        ) : (
          <div></div></div>