File tree Expand file tree Collapse file tree 4 files changed +33
-31
lines changed
collection/src/webapp/components/organisms/MainCollectionCard
ed-resource/src/webapp/components/organisms/MainResourceCard
storybook/src/components/pages/Collection Expand file tree Collapse file tree 4 files changed +33
-31
lines changed Original file line number Diff line number Diff line change @@ -196,17 +196,16 @@ export const MainCollectionCard: FC<MainCollectionCardProps> = ({
196196 }
197197 : null
198198
199- const deleteButton : FloatingMenuContentItem | null =
200- ! empty && canDelete
201- ? {
202- Element : (
203- < div key = "delete-button" onClick = { ( ) => setIsToDelete ( true ) } >
204- < Delete />
205- Delete
206- </ div >
207- ) ,
208- }
209- : null
199+ const deleteButton : FloatingMenuContentItem | null = canDelete
200+ ? {
201+ Element : (
202+ < div key = "delete-button" onClick = { ( ) => setIsToDelete ( true ) } >
203+ < Delete />
204+ Delete
205+ </ div >
206+ ) ,
207+ }
208+ : null
210209
211210 const unpublishButton : FloatingMenuContentItem | null =
212211 canPublish && isPublished
@@ -278,6 +277,7 @@ export const MainCollectionCard: FC<MainCollectionCardProps> = ({
278277 className = { `${ isCurrentlySaving ? 'loading' : '' } ` }
279278 color = "green"
280279 onClick = { isCurrentlySaving ? handleOnEditClick : handleOnSaveClick }
280+ disabled = { empty }
281281 >
282282 < div
283283 className = "loading"
Original file line number Diff line number Diff line change @@ -161,7 +161,6 @@ export const MainResourceCard: FC<MainResourceCardProps> = ({
161161 const handleOnSaveClick = ( ) => {
162162 setisWaitingForSaving ( true )
163163 setShouldShowErrors ( false )
164-
165164 save ( )
166165 }
167166
@@ -297,16 +296,15 @@ export const MainResourceCard: FC<MainResourceCardProps> = ({
297296 }
298297 : null
299298
300- const deleteButton : FloatingMenuContentItem | null =
301- canDelete && ! empty
302- ? {
303- Element : (
304- < div key = "delete-button" onClick = { ( ) => setIsToDelete ( true ) } >
305- < Delete /> Delete
306- </ div >
307- ) ,
308- }
309- : null
299+ const deleteButton : FloatingMenuContentItem | null = canDelete
300+ ? {
301+ Element : (
302+ < div key = "delete-button" onClick = { ( ) => setIsToDelete ( true ) } >
303+ < Delete /> Delete
304+ </ div >
305+ ) ,
306+ }
307+ : null
310308
311309 const publishButton : FloatingMenuContentItem | null =
312310 canPublish && ! isPublished
@@ -412,7 +410,7 @@ export const MainResourceCard: FC<MainResourceCardProps> = ({
412410 ] . filter ( ( item ) : item is FloatingMenuContentItem => ! ! item )
413411
414412 const moreButton =
415- ! empty && updatedMoreButtonItems . length > 0 ? (
413+ updatedMoreButtonItems . length > 0 ? (
416414 // updatedMoreButtonItems.length === 1 ? (
417415 // updatedMoreButtonItems.map(i => {
418416 // return (
@@ -449,6 +447,7 @@ export const MainResourceCard: FC<MainResourceCardProps> = ({
449447 className = { `${ isCurrentlySaving ? 'loading' : '' } ` }
450448 color = "green"
451449 onClick = { isCurrentlySaving ? handleOnEditClick : handleOnSaveClick }
450+ disabled = { empty }
452451 >
453452 < div
454453 className = "loading"
Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ export const LoggedIn: CollectionStory = () => {
5353
5454export const New : CollectionStory = ( ) => {
5555 const props = useCollectionStoryProps ( {
56+ isEditingAtStart : true ,
5657 mainColumnItems : [ ] ,
5758 data : {
5859 mnUrl : 'moodle.com' ,
Original file line number Diff line number Diff line change @@ -152,14 +152,16 @@ export const useCollectionStoryProps = (
152152 id : 'qjnwglkd69io-sports' ,
153153 mnUrl : 'collection.url' ,
154154 ...overrides ?. data ,
155- image : {
156- location :
157- 'https://images.unsplash.com/photo-1543964198-d54e4f0e44e3?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2670&q=80' ,
158- credits : {
159- owner : { name : 'Leonard Rush' , url : 'https://unsplash.com/@lennyrush' } ,
160- provider : { name : 'Unsplash' , url : 'https://unsplash.com' } ,
161- } ,
162- } ,
155+ image : overrides ?. data ?. image
156+ ? {
157+ location :
158+ 'https://images.unsplash.com/photo-1543964198-d54e4f0e44e3?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2670&q=80' ,
159+ credits : {
160+ owner : { name : 'Leonard Rush' , url : 'https://unsplash.com/@lennyrush' } ,
161+ provider : { name : 'Unsplash' , url : 'https://unsplash.com' } ,
162+ } ,
163+ }
164+ : undefined ,
163165 }
164166
165167 const collectionForm : CollectionFormProps = {
You can’t perform that action at this time.
0 commit comments