@@ -29,7 +29,7 @@ interface ExportOptionMenu {
2929 label : string
3030 icon ?: React . ReactElement
3131 isVisible : boolean | ( ( images : string [ ] ) => boolean )
32- options : Array < ExportOptionButton >
32+ options : Array < Omit < ExportOptionButton , "type" > >
3333}
3434
3535export interface HeaderProps {
@@ -68,57 +68,63 @@ export const Header = ({ onClose, exportOptions }: HeaderProps) => {
6868 />
6969 < Text > { headerText } </ Text >
7070 < Spacer />
71- { exportOptions ?. map ( ( exportOption ) => (
72- < React . Fragment key = { `export-option-${ exportOption . label } ` } >
73- < Divider
74- orientation = "vertical"
75- borderColor = "editorBattleshipGrey.100"
76- />
77- { exportOption . type === "button" ? (
78- < Button
79- key = { `export-button-${ exportOption . label } ` }
80- leftIcon = { exportOption . icon }
81- aria-label = { exportOption . label }
82- variant = "ghost"
83- fontWeight = "normal"
84- size = "sm"
85- onClick = { ( ) => exportOption . onClick ( imageList ) }
86- >
87- { exportOption . label }
88- </ Button >
89- ) : (
90- < Menu key = { `export-menu-${ exportOption . label } ` } >
91- < MenuButton >
92- < Button
93- leftIcon = { exportOption . icon }
94- aria-label = { exportOption . label }
95- variant = "ghost"
96- fontWeight = "normal"
97- size = "sm"
98- >
99- { exportOption . label }
100- </ Button >
101- </ MenuButton >
102- < MenuList >
103- { exportOption . options
104- . filter ( ( option ) =>
105- typeof option . isVisible === "boolean"
106- ? option . isVisible
107- : option . isVisible ( imageList ) ,
108- )
109- . map ( ( option ) => (
110- < MenuItem
111- key = { `export-menu-option-${ option . label } ` }
112- onClick = { ( ) => option . onClick ( imageList ) }
113- >
114- { option . label }
115- </ MenuItem >
116- ) ) }
117- </ MenuList >
118- </ Menu >
119- ) }
120- </ React . Fragment >
121- ) ) }
71+ { exportOptions
72+ ?. filter ( ( exportOption ) =>
73+ typeof exportOption . isVisible === "boolean"
74+ ? exportOption . isVisible
75+ : exportOption . isVisible ( imageList ) ,
76+ )
77+ . map ( ( exportOption ) => (
78+ < React . Fragment key = { `export-option-${ exportOption . label } ` } >
79+ < Divider
80+ orientation = "vertical"
81+ borderColor = "editorBattleshipGrey.100"
82+ />
83+ { exportOption . type === "button" ? (
84+ < Button
85+ key = { `export-button-${ exportOption . label } ` }
86+ leftIcon = { exportOption . icon }
87+ aria-label = { exportOption . label }
88+ variant = "ghost"
89+ fontWeight = "normal"
90+ size = "sm"
91+ onClick = { ( ) => exportOption . onClick ( imageList ) }
92+ >
93+ { exportOption . label }
94+ </ Button >
95+ ) : (
96+ < Menu key = { `export-menu-${ exportOption . label } ` } >
97+ < MenuButton >
98+ < Button
99+ leftIcon = { exportOption . icon }
100+ aria-label = { exportOption . label }
101+ variant = "ghost"
102+ fontWeight = "normal"
103+ size = "sm"
104+ >
105+ { exportOption . label }
106+ </ Button >
107+ </ MenuButton >
108+ < MenuList >
109+ { exportOption . options
110+ . filter ( ( option ) =>
111+ typeof option . isVisible === "boolean"
112+ ? option . isVisible
113+ : option . isVisible ( imageList ) ,
114+ )
115+ . map ( ( option ) => (
116+ < MenuItem
117+ key = { `export-menu-option-${ option . label } ` }
118+ onClick = { ( ) => option . onClick ( imageList ) }
119+ >
120+ { option . label }
121+ </ MenuItem >
122+ ) ) }
123+ </ MenuList >
124+ </ Menu >
125+ ) }
126+ </ React . Fragment >
127+ ) ) }
122128 < Divider orientation = "vertical" borderColor = "editorBattleshipGrey.100" />
123129 < Button
124130 leftIcon = { < Icon boxSize = { "5" } as = { PiX } /> }
0 commit comments