@@ -19,7 +19,9 @@ import {
1919 Gallery ,
2020 GalleryItem ,
2121 GalleryItemAction ,
22+ getGalleryItemCopyLinkAction ,
2223 getGalleryItemDocument ,
24+ getGalleryItemDownloadAction ,
2325 getGalleryItemImage ,
2426 getGalleryItemVideo ,
2527} from '../' ;
@@ -190,6 +192,53 @@ const FilesGalleryTemplate: StoryFn<GalleryProps> = () => {
190192
191193export const FilesGallery = FilesGalleryTemplate . bind ( { } ) ;
192194
195+ const FilesGalleryWithPreDefinedActionsTemplate : StoryFn < GalleryProps > = ( ) => {
196+ const mobile = useMobile ( ) ;
197+
198+ const [ open , setOpen ] = React . useState ( false ) ;
199+
200+ const handleToggle = React . useCallback ( ( ) => {
201+ setOpen ( false ) ;
202+ } , [ ] ) ;
203+
204+ const handleOpen = React . useCallback ( ( ) => {
205+ setOpen ( true ) ;
206+ } , [ ] ) ;
207+
208+ return (
209+ < React . Fragment >
210+ < Button onClick = { handleOpen } view = "action" size = "l" >
211+ Open gallery
212+ </ Button >
213+ < ThemeProvider theme = "dark" >
214+ < Gallery open = { open } onOpenChange = { handleToggle } >
215+ { files . map ( ( file , index ) => (
216+ < GalleryItem
217+ key = { index }
218+ { ...getGalleryItemFile ( file , mobile ) }
219+ actions = {
220+ file . type === 'text'
221+ ? [ ]
222+ : [
223+ getGalleryItemCopyLinkAction ( {
224+ copyUrl : file . url ,
225+ } ) ,
226+ getGalleryItemDownloadAction ( {
227+ downloadUrl : file . url ,
228+ } ) ,
229+ ]
230+ }
231+ interactive = { file . interactive }
232+ />
233+ ) ) }
234+ </ Gallery >
235+ </ ThemeProvider >
236+ </ React . Fragment >
237+ ) ;
238+ } ;
239+
240+ export const FilesGalleryWithPreDefinedActions = FilesGalleryWithPreDefinedActionsTemplate . bind ( { } ) ;
241+
193242const EmptyGalleryTemplate : StoryFn < GalleryProps > = ( ) => {
194243 const [ open , setOpen ] = React . useState ( false ) ;
195244
0 commit comments