@@ -12,6 +12,7 @@ import DraggableList, { SortableItem } from '../../editors/sharedComponents/Drag
1212
1313import ErrorAlert from '../../generic/alert-error' ;
1414import { getItemIcon } from '../../generic/block-type-utils' ;
15+ import { COMPONENT_TYPES } from '../../generic/block-type-utils/constants' ;
1516import { IframeProvider } from '../../generic/hooks/context/iFrameContext' ;
1617import Loading from '../../generic/Loading' ;
1718import TagCount from '../../generic/tag-count' ;
@@ -24,6 +25,15 @@ import { useLibraryRoutes } from '../routes';
2425import messages from './messages' ;
2526import { useSidebarContext } from '../common/context/SidebarContext' ;
2627
28+ /** Components that need large min height in preview */
29+ const LARGE_COMPONENTS = [
30+ COMPONENT_TYPES . advanced ,
31+ COMPONENT_TYPES . dragAndDrop ,
32+ COMPONENT_TYPES . discussion ,
33+ 'lti' ,
34+ 'lti_consumer' ,
35+ ] ;
36+
2737export const LibraryUnitBlocks = ( ) => {
2838 const intl = useIntl ( ) ;
2939 const [ orderedBlocks , setOrderedBlocks ] = useState < LibraryBlockMetadata [ ] > ( [ ] ) ;
@@ -79,6 +89,14 @@ export const LibraryUnitBlocks = () => {
7989 navigateTo ( { componentId : block . id } ) ;
8090 } ;
8191
92+ /* istanbul ignore next */
93+ const calculateMinHeight = ( block : LibraryBlockMetadata ) => {
94+ if ( LARGE_COMPONENTS . includes ( block . blockType ) ) {
95+ return '700px' ;
96+ }
97+ return '200px' ;
98+ } ;
99+
82100 const renderedBlocks = orderedBlocks ?. map ( ( block ) => (
83101 < IframeProvider key = { block . id } >
84102 < SortableItem
@@ -124,6 +142,7 @@ export const LibraryUnitBlocks = () => {
124142 < LibraryBlock
125143 usageKey = { block . id }
126144 version = { showOnlyPublished ? 'published' : undefined }
145+ minHeight = { calculateMinHeight ( block ) }
127146 />
128147 </ div >
129148 </ SortableItem >
0 commit comments