Skip to content

Commit 03b0fda

Browse files
committed
(refactor): sketchSVG function
1 parent c6fe7e6 commit 03b0fda

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/components/animatedModal/AnimatedModal.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,20 +139,26 @@ const AnimatedModal = forwardRef(
139139
);
140140
}
141141

142+
function sketchSVG(): React.ReactElement {
143+
return (
144+
<svg
145+
id="modal-sketch-svg"
146+
xmlns="http://www.w3.org/2000/svg"
147+
width="100%"
148+
height="100%"
149+
preserveAspectRatio="none">
150+
<rect x="0" y="0" fill="none" width="226" height="162" rx="3" ry="3"></rect>
151+
</svg>
152+
);
153+
}
154+
142155
return (
143156
<div id="animated-modal-container" className={modalClass}>
144157
<div
145158
id="animated-modal-background"
146159
onClick={props.closeOnBackgroundClick ? onBackgroundClick : undefined}>
147160
<div id="animated-modal">
148-
<svg
149-
id="modal-sketch-svg"
150-
xmlns="http://www.w3.org/2000/svg"
151-
width="100%"
152-
height="100%"
153-
preserveAspectRatio="none">
154-
<rect x="0" y="0" fill="none" width="226" height="162" rx="3" ry="3"></rect>
155-
</svg>
161+
{props.animation === ModalAnimation.Sketch ? sketchSVG() : undefined}
156162
<div id="modal-content">{props.children ? props.children : defaultModal()}</div>
157163
</div>
158164
</div>

0 commit comments

Comments
 (0)