sokko-g/website/src/features/toolboxes/modules/TextImportModal.jsx
Shinuwa 22b397ebfa Document Sokko G's architecture and folders, and move JavaScript file headers to JSDoc @file blocks
Add ARCHITECTURE.md (layers, flows, folder map, glossary), CONTRIBUTING.md
(setup and step-by-step recipes) and a README in each main folder, with an
index of docs/. Convert the 511 JavaScript headers from "// Rôle :" lines to
JSDoc @file blocks, define a three-level header template in website/AGENTS.md
and check the header in tests/file-headers.test.mjs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 09:42:13 +01:00

53 lines
2.3 KiB
JavaScript

/**
* @file Affiche la modale d'import/export texte partagée par les outils compatibles.
*/
import { Icon } from "../../../components/Icon.jsx";
import { Modal } from "../../../components/Modal.jsx";
export function TextImportModal({ title, value, placeholder, submitLabel, readOnly = false, error = "", info = "", onChange, onSubmit, onCopy, onClose }) {
return (
<Modal rootClassName="confirm-modal-root text-import-modal-root" dialogClassName="confirm-modal nds-modal text-import-modal-dialog" labelledBy="text-import-title" onRequestClose={onClose}>
<header>
<h2 id="text-import-title">{title}</h2>
<button className="drawer-close-button nds-icon-button" data-size="sm" type="button" onClick={onClose} aria-label="Fermer" title="Fermer">
<Icon name="close" />
</button>
</header>
<form className="text-import-modal-form" onSubmit={onSubmit}>
<textarea
data-modal-initial-focus=""
className={`nds-textarea ${error ? "has-error" : ""}`.trim()}
data-size="sm"
readOnly={readOnly}
value={value}
onChange={(event) => onChange?.(event.target.value)}
placeholder={placeholder}
rows={9}
aria-invalid={Boolean(error)}
aria-describedby={error ? "text-import-error" : undefined}
/>
{info && (
<p className="text-import-info nds-inline-notice">
<Icon name="info" />
<span>{info}</span>
</p>
)}
{error && (
<p className="text-import-error nds-inline-notice" data-variant="danger" id="text-import-error" role="alert">
<Icon name="close" />
<span>{error}</span>
</p>
)}
<footer className="nds-modal-footer">
<button className="nds-button" data-size="sm" type="button" onClick={onClose}>Annuler</button>
{readOnly ? (
<button className="nds-button" data-size="sm" data-variant="primary" type="button" onClick={onCopy}>{submitLabel}</button>
) : (
<button className="nds-button" data-size="sm" data-variant="primary" type="submit">{submitLabel}</button>
)}
</footer>
</form>
</Modal>
);
}