From de43eb05d2e43ab31effce3dcca62ad91a556b26 Mon Sep 17 00:00:00 2001
From: Elizabeth Hunt <me@liz.coffee>
Date: Sun, 5 Oct 2025 16:42:02 -0700
Subject: Init

---
 src/components/SaveModal.tsx | 79 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 79 insertions(+)
 create mode 100644 src/components/SaveModal.tsx

(limited to 'src/components/SaveModal.tsx')

diff --git a/src/components/SaveModal.tsx b/src/components/SaveModal.tsx
new file mode 100644
index 0000000..1ed8ada
--- /dev/null
+++ b/src/components/SaveModal.tsx
@@ -0,0 +1,79 @@
+import React, { useState } from 'react';
+
+interface SaveModalProps {
+    ansiOutput: string;
+    onSave: (name: string) => void;
+    onClose: () => void;
+}
+
+export const SaveModal: React.FC<SaveModalProps> = ({ ansiOutput, onSave, onClose }) => {
+    const [name, setName] = useState('');
+    const [copied, setCopied] = useState(false);
+
+    const handleSave = () => {
+        if (name.trim()) {
+            onSave(name.trim());
+            onClose();
+        }
+    };
+
+    const handleCopy = () => {
+        navigator.clipboard.writeText(ansiOutput).then(() => {
+            setCopied(true);
+            setTimeout(() => setCopied(false), 2000);
+        });
+    };
+
+    return (
+        <div style={{
+            position: 'fixed',
+            top: 0,
+            left: 0,
+            right: 0,
+            bottom: 0,
+            backgroundColor: 'rgba(0, 0, 0, 0.5)',
+            display: 'flex',
+            alignItems: 'center',
+            justifyContent: 'center',
+            zIndex: 2000,
+        }}>
+            <div style={{
+                backgroundColor: 'var(--background)',
+                border: '3px solid var(--regular6)',
+                borderRadius: '4px',
+                padding: '1.5rem',
+                minWidth: '300px',
+                display: 'flex',
+                flexDirection: 'column',
+                gap: '1rem',
+            }}>
+                <h3>Save ANSI Art</h3>
+                <input
+                    type="text"
+                    placeholder="Enter a name..."
+                    value={name}
+                    onChange={(e) => setName(e.target.value)}
+                    onKeyDown={(e) => e.key === 'Enter' && handleSave()}
+                    autoFocus
+                    style={{
+                        padding: '0.5rem',
+                        border: '2px solid var(--regular3)',
+                        borderRadius: '4px',
+                        backgroundColor: 'var(--background)',
+                        color: 'var(--foreground)',
+                        fontSize: '1rem',
+                    }}
+                />
+                <div style={{ display: 'flex', gap: '0.5rem' }}>
+                    <button onClick={handleCopy} style={{ flex: 1 }}>
+                        {copied ? 'Copied!' : 'Copy to Clipboard'}
+                    </button>
+                    <button onClick={handleSave} disabled={!name.trim()} style={{ flex: 1 }}>
+                        Save
+                    </button>
+                </div>
+                <button onClick={onClose}>Cancel</button>
+            </div>
+        </div>
+    );
+};
-- 
cgit v1.3

