@@ -35,7 +35,11 @@ const LARGE_COMPONENTS = [
3535 'lti_consumer' ,
3636] ;
3737
38- export const LibraryUnitBlocks = ( ) => {
38+ interface LibraryUnitBlocksProps {
39+ preview ?: boolean ;
40+ }
41+
42+ export const LibraryUnitBlocks = ( { preview = false } : LibraryUnitBlocksProps ) => {
3943 const intl = useIntl ( ) ;
4044 const [ orderedBlocks , setOrderedBlocks ] = useState < LibraryBlockMetadata [ ] > ( [ ] ) ;
4145 const [ isManageTagsDrawerOpen , openManageTagsDrawer , closeManageTagsDrawer ] = useToggle ( false ) ;
@@ -151,43 +155,44 @@ export const LibraryUnitBlocks = () => {
151155 </ IframeProvider >
152156 ) ) ;
153157
154-
155158 return (
156159 < div className = "library-unit-page" >
157160 < DraggableList itemList = { orderedBlocks } setState = { setOrderedBlocks } updateOrder = { handleReorder } >
158161 { renderedBlocks }
159162 </ DraggableList >
160- < div className = "d-flex" >
161- < div className = "w-100 mr-2" >
162- < Button
163- className = "ml-2"
164- iconBefore = { Add }
165- variant = "outline-primary rounded-0"
166- disabled = { readOnly }
167- onClick = { openAddContentSidebar }
168- block
169- >
170- { intl . formatMessage ( messages . newContentButton ) }
171- </ Button >
172- </ div >
173- < div className = "w-100 ml-2" >
174- < Button
175- className = "ml-2"
176- iconBefore = { Add }
177- variant = "outline-primary rounded-0"
178- disabled = { readOnly }
179- onClick = { showAddLibraryContentModal }
180- block
181- >
182- { intl . formatMessage ( messages . addExistingContentButton ) }
183- </ Button >
184- < PickLibraryContentModal
185- isOpen = { isAddLibraryContentModalOpen }
186- onClose = { closeAddLibraryContentModal }
187- extraFilter = { [ 'NOT block_type = "unit"' ] }
188- />
163+ { ! preview && (
164+ < div className = "d-flex" >
165+ < div className = "w-100 mr-2" >
166+ < Button
167+ className = "ml-2"
168+ iconBefore = { Add }
169+ variant = "outline-primary rounded-0"
170+ disabled = { readOnly }
171+ onClick = { openAddContentSidebar }
172+ block
173+ >
174+ { intl . formatMessage ( messages . newContentButton ) }
175+ </ Button >
176+ </ div >
177+ < div className = "w-100 ml-2" >
178+ < Button
179+ className = "ml-2"
180+ iconBefore = { Add }
181+ variant = "outline-primary rounded-0"
182+ disabled = { readOnly }
183+ onClick = { showAddLibraryContentModal }
184+ block
185+ >
186+ { intl . formatMessage ( messages . addExistingContentButton ) }
187+ </ Button >
188+ < PickLibraryContentModal
189+ isOpen = { isAddLibraryContentModalOpen }
190+ onClose = { closeAddLibraryContentModal }
191+ extraFilter = { [ 'NOT block_type = "unit"' ] }
192+ />
193+ </ div >
189194 </ div >
190- </ div >
195+ ) }
191196 < ContentTagsDrawerSheet
192197 id = { componentId }
193198 onClose = { onTagSidebarClose }
0 commit comments