@@ -85,6 +85,13 @@ const ExportShape = ({ show, setShow, shape }) => {
8585 console . log ( { exportData} ) ;
8686 } ;
8787
88+ const setExportType = value => {
89+ setExportData ( {
90+ ...exportData ,
91+ 'type' : value
92+ } ) ;
93+ }
94+
8895 // Export method
8996 const doExport = ( id , name ) => {
9097 console . log ( `Save as ${ exportData . type } ` ) ;
@@ -146,7 +153,7 @@ const ExportShape = ({ show, setShow, shape }) => {
146153 < Row >
147154 < Col >
148155 < Form >
149- < Form . Group className = "mb-3" controlId = "export-name" >
156+ < Form . Group className = "mb-3" id = "export-name" >
150157 < Form . Label > Name</ Form . Label >
151158 < Form . Control type = "text" name = "name" value = { exportData . name } onChange = { handleChange } />
152159 </ Form . Group >
@@ -162,8 +169,8 @@ const ExportShape = ({ show, setShow, shape }) => {
162169 />
163170 </ Form . Group >
164171 < Row >
165- < Form . Group as = { Col } controlId = "export-width" >
166- < Form . Label > Set a width(in px)</ Form . Label >
172+ < Form . Group as = { Col } id = "export-width" >
173+ < Form . Label > Set a width({ exportData . width } px)</ Form . Label >
167174 < Form . Control
168175 type = "range"
169176 min = "100"
@@ -173,8 +180,8 @@ const ExportShape = ({ show, setShow, shape }) => {
173180 name = "width"
174181 onChange = { handleChange } />
175182 </ Form . Group >
176- < Form . Group as = { Col } controlId = "export-height" >
177- < Form . Label > Set a height(in px)</ Form . Label >
183+ < Form . Group as = { Col } id = "export-height" >
184+ < Form . Label > Set a height({ exportData . height } px)</ Form . Label >
178185 < Form . Control
179186 type = "range"
180187 min = "100"
@@ -186,78 +193,24 @@ const ExportShape = ({ show, setShow, shape }) => {
186193 </ Form . Group >
187194 </ Row >
188195
189- { /* <div>
190- <label htmlFor="export-name">Name</label>
191- <input
192- type="text"
193- name="name"
194- id="export-name"
195- value={exportData.name}
196- onChange={handleChange} />
197- </div> */ }
198-
199- { /* <div>
200- <label htmlFor="export-color">Color</label>
201- <input
202- type="color"
203- name="backgroundColor"
204- id="export-color"
205- value={exportData.backgroundColor}
206- onChange={handleChange} />
207- </div> */ }
208-
209- { /* <div>
210- <label htmlFor="export-width">Set a width(in px)</label>
211- <input
212- type="range"
213- min="100"
214- max="700"
215- value={exportData.width}
216- id="export-width"
217- name="width"
218- onChange={handleChange} />
219-
220- <label htmlFor="export-height">Set a height(in px)</label>
221- <input
222- type="range"
223- min="100"
224- max="700"
225- value={exportData.height}
226- id="export-height"
227- name="height"
228- onChange={handleChange} />
229- </div> */ }
230-
231196 < div >
232- < Form . Group >
233- < Form . Label > File Format</ Form . Label >
234- < div >
235- < ToggleButtonGroup type = "radio" name = "options" defaultValue = { 1 } variant = "outline-dark" size = "sm" defaultValue = { 'png' } >
236- < ToggleButton id = "tbg-radio-1" value = { 'png' } variant = "outline-dark" >
237- PNG
238- </ ToggleButton >
239- < ToggleButton id = "tbg-radio-2" value = { 'jpeg' } variant = "outline-dark" >
240- JPEG
241- </ ToggleButton >
242- < ToggleButton id = "tbg-radio-3" value = { 'svg' } variant = "outline-dark" >
243- SVG
244- </ ToggleButton >
245- </ ToggleButtonGroup >
246- </ div >
247- </ Form . Group >
248- < Radios
249- groupName = "type"
250- heading = "Export as:"
251- options = { [
252- { value : "png" , displayValue : "PNG" } ,
253- { value : "jpeg" , displayValue : "JPEG" } ,
254- { value : "svg" , displayValue : "SVG" } ,
255- ] }
256- selectedOption = { exportData . type }
257- onValueChange = { handleChange }
258- />
259- </ div >
260-
197+ < Form . Group >
198+ < Form . Label > Export As</ Form . Label >
199+ < div >
200+ < ToggleButtonGroup type = "radio" name = "options" defaultValue = { 1 } variant = "outline-dark" size = "sm" defaultValue = { exportData . type } >
201+ < ToggleButton id = "tbg-radio-1" value = { 'png' } variant = "outline-dark" onClick = { ( ) => setExportType ( 'png' ) } >
202+ PNG
203+ </ ToggleButton >
204+ < ToggleButton id = "tbg-radio-2" value = { 'jpeg' } variant = "outline-dark" onClick = { ( ) => setExportType ( 'jpeg' ) } >
205+ JPEG
206+ </ ToggleButton >
207+ < ToggleButton id = "tbg-radio-3" value = { 'svg' } variant = "outline-dark" onClick = { ( ) => setExportType ( 'svg' ) } >
208+ SVG
209+ </ ToggleButton >
210+ </ ToggleButtonGroup >
211+ </ div >
212+ </ Form . Group >
213+ </ div >
261214 </ Form >
262215 </ Col >
263216 < Col >
@@ -277,7 +230,7 @@ const ExportShape = ({ show, setShow, shape }) => {
277230 </ Modal . Body >
278231
279232 < Modal . Footer >
280- < Button variant = "outline-info" >
233+ < Button variant = "outline-info" onClick = { ( ) => setShow ( false ) } >
281234 Cancel
282235 </ Button >
283236 < Button variant = "secondary"
0 commit comments