From de43eb05d2e43ab31effce3dcca62ad91a556b26 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt 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 = ({ 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 ( +
+
+

Save ANSI Art

+ 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', + }} + /> +
+ + +
+ +
+
+ ); +}; -- cgit v1.2.3-70-g09d2