Skip to content

Commit 977b4c9

Browse files
committed
Added Back Copy Functionality
Signed-off-by: SplinterSword <[email protected]>
1 parent 24dc227 commit 977b4c9

File tree

1 file changed

+13
-3
lines changed
  • site/src/components/ShapeBuilder

1 file changed

+13
-3
lines changed

site/src/components/ShapeBuilder/index.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Updated ShapeBuilder with Curved Drawing Support (Figma-like)
2+
// Style preserved from your original component
3+
14
import React, { useEffect, useRef, useState } from "react";
25
import { Wrapper, CanvasContainer, OutputBox, StyledSVG } from "./shapeBuilder.styles";
36
import { Button, Typography, Box } from "@sistent/sistent";
@@ -20,8 +23,6 @@ const ShapeBuilder = () => {
2023
const [isClosed, setIsClosed] = useState(false);
2124
const [dragState, setDragState] = useState(null);
2225
const [result, setResult] = useState("");
23-
24-
const [error, setError] = useState(null);
2526
const [showCopied, setShowCopied] = useState(false);
2627

2728
const handleCopyToClipboard = async () => {
@@ -329,7 +330,9 @@ const ShapeBuilder = () => {
329330
<path d="M 16 0 L 0 0 0 16" fill="none" stroke="#797d7a" strokeWidth="1" />
330331
</pattern>
331332
</defs>
333+
332334
<rect className="grid" width="100%" height="100%" fill="url(#grid)" />
335+
<rect width="100%" height="100%" fill="url(#majorGrid)" opacity="0.55" />
333336

334337
{/* path preview */}
335338
<path d={buildPathD()} fill={isClosed ? defaultStroke : 'none'} fillOpacity={isClosed ? 0.3 : 1} stroke={defaultStroke} strokeWidth={2} />
@@ -406,14 +409,21 @@ const ShapeBuilder = () => {
406409
<Button variant="contained" onClick={clear}>Clear</Button>
407410
<Button variant="contained" onClick={() => setIsClosed(true)}>Close Shape</Button>
408411
<Button variant="contained" onClick={maximize}>Maximize</Button>
409-
</Box>
412+
</Box>
410413

411414
<OutputBox>
412415
<Typography variant="subtitle1" component="h6">
413416
SVG Path (d attribute):
414417
</Typography>
415418
<textarea readOnly value={result} />
416419
</OutputBox>
420+
421+
<Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'center', mt: 2 }}>
422+
<Button variant="contained" onClick={handleCopyToClipboard}>Copy</Button>
423+
{showCopied && (
424+
<span style={{ color: '#00B39F', marginTop: '8px' }}>Copied!</span>
425+
)}
426+
</Box>
417427
</Wrapper>
418428
);
419429
};

0 commit comments

Comments
 (0)