@@ -3,15 +3,27 @@ import React, { useState, useEffect } from "react";
33// dynamic from Next.js
44import dynamic from "next/dynamic" ;
55
6- // modal
6+ // Bootstrap
77import Modal from "react-bootstrap/Modal" ;
8-
9- // button
8+ import Container from 'react-bootstrap/Container'
9+ import Row from 'react-bootstrap/Row'
10+ import Col from 'react-bootstrap/Col'
1011import Button from "react-bootstrap/Button" ;
12+ import Form from 'react-bootstrap/Form' ;
13+ import ToggleButtonGroup from 'react-bootstrap/ToggleButtonGroup'
14+ import ToggleButton from 'react-bootstrap/ToggleButton'
15+
16+ // Styled Component
17+ import styled from "styled-components" ;
1118
1219// Clip-Path
1320const Shape = dynamic ( import ( "react-clip-path" ) , { ssr : false } ) ;
1421
22+ const ShapeContainer = styled . section `
23+ border: solid 1px var(--color-neutral-30);
24+ padding: 1rem;
25+ ` ;
26+
1527// Toast
1628import toast from "react-hot-toast" ;
1729
@@ -39,8 +51,8 @@ const ExportShape = ({ show, setShow, shape }) => {
3951 setExportData ( {
4052 'name' : shape . name ,
4153 'type' : 'png' ,
42- 'width' : '300 ' ,
43- 'height' : '300 ' ,
54+ 'width' : '240 ' ,
55+ 'height' : '240 ' ,
4456 'backgroundColor' : shape . backgroundColor
4557 } ) ;
4658 setLoaded ( true ) ;
@@ -130,81 +142,150 @@ const ExportShape = ({ show, setShow, shape }) => {
130142 < Modal . Title > Export { exportData . name } </ Modal . Title >
131143 </ Modal . Header >
132144 < Modal . Body >
133- < div >
134- < Shape
135- name = { exportData . name }
136- formula = { shape . formula }
137- width = { `${ exportData . width } px` }
138- height = { `${ exportData . height } px` }
139- backgroundColor = { exportData . backgroundColor }
140- id = { getShapeId ( exportData . name , true ) }
141- />
142- </ div >
143- < form >
144- < div >
145- < label htmlFor = "export-name" > Name</ label >
146- < input
147- type = "text"
148- name = "name"
149- id = "export-name"
150- value = { exportData . name }
151- onChange = { handleChange } />
152- </ div >
153-
154- < div >
155- < label htmlFor = "export-color" > Color</ label >
156- < input
157- type = "color"
158- name = "backgroundColor"
159- id = "export-color"
160- value = { exportData . backgroundColor }
161- onChange = { handleChange } />
162- </ div >
163-
164- < div >
165- < label htmlFor = "export-width" > Set a width(in px)</ label >
166- < input
167- type = "range"
168- min = "100"
169- max = "700"
170- value = { exportData . width }
171- id = "export-width"
172- name = "width"
173- onChange = { handleChange } />
174-
175- < label htmlFor = "export-height" > Set a height(in px)</ label >
176- < input
177- type = "range"
178- min = "100"
179- max = "700"
180- value = { exportData . height }
181- id = "export-height"
182- name = "height"
183- onChange = { handleChange } />
184- </ div >
185-
186- < div >
187- < Radios
188- groupName = "type"
189- heading = "Export as:"
190- options = { [
191- { value : "png" , displayValue : "png" } ,
192- { value : "jpeg" , displayValue : "jpeg" } ,
193- { value : "svg" , displayValue : "svg" } ,
194- ] }
195- selectedOption = { exportData . type }
196- onValueChange = { handleChange }
197- />
198- </ div >
199- </ form >
145+ < Container fluid >
146+ < Row >
147+ < Col >
148+ < Form >
149+ < Form . Group className = "mb-3" controlId = "export-name" >
150+ < Form . Label > Name</ Form . Label >
151+ < Form . Control type = "text" name = "name" value = { exportData . name } onChange = { handleChange } />
152+ </ Form . Group >
153+ < Form . Group >
154+ < Form . Label htmlFor = "exampleColorInput" > Color picker</ Form . Label >
155+ < Form . Control
156+ type = "color"
157+ name = "backgroundColor"
158+ id = "export-color"
159+ value = { exportData . backgroundColor }
160+ onChange = { handleChange }
161+ className = "form-control-color"
162+ />
163+ </ Form . Group >
164+ < Row >
165+ < Form . Group as = { Col } controlId = "export-width" >
166+ < Form . Label > Set a width(in px)</ Form . Label >
167+ < Form . Control
168+ type = "range"
169+ min = "100"
170+ max = "700"
171+ value = { exportData . width }
172+ id = "export-width"
173+ name = "width"
174+ onChange = { handleChange } />
175+ </ Form . Group >
176+ < Form . Group as = { Col } controlId = "export-height" >
177+ < Form . Label > Set a height(in px)</ Form . Label >
178+ < Form . Control
179+ type = "range"
180+ min = "100"
181+ max = "700"
182+ value = { exportData . height }
183+ id = "export-height"
184+ name = "height"
185+ onChange = { handleChange } />
186+ </ Form . Group >
187+ </ Row >
188+
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+
231+ < 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+
261+ </ Form >
262+ </ Col >
263+ < Col >
264+ < ShapeContainer >
265+ < Shape
266+ name = { exportData . name }
267+ formula = { shape . formula }
268+ width = { `${ exportData . width } px` }
269+ height = { `${ exportData . height } px` }
270+ backgroundColor = { exportData . backgroundColor }
271+ id = { getShapeId ( exportData . name , true ) }
272+ />
273+ </ ShapeContainer >
274+ </ Col >
275+ </ Row >
276+ </ Container >
200277 </ Modal . Body >
201278
202279 < Modal . Footer >
203- < Button
280+ < Button variant = "outline-info" >
281+ Cancel
282+ </ Button >
283+ < Button variant = "secondary"
204284 onClick = { ( ) => doExport ( getShapeId ( exportData . name , true ) , exportData . name ) }
205285 >
206286 Export
207287 </ Button >
288+
208289 </ Modal . Footer >
209290 </ Modal >
210291 ) }
0 commit comments