Widen Revit CSV dialog
This commit is contained in:
@@ -5,6 +5,7 @@ import React, { type FormEvent, type ReactNode } from "react";
|
||||
interface FormModalProps {
|
||||
children: ReactNode;
|
||||
description?: string;
|
||||
dialogSize?: "large" | "viewport";
|
||||
isSaving: boolean;
|
||||
onClose: () => void;
|
||||
onSubmit: (event: FormEvent<HTMLFormElement>) => void;
|
||||
@@ -16,6 +17,7 @@ interface FormModalProps {
|
||||
export function FormModal({
|
||||
children,
|
||||
description,
|
||||
dialogSize = "large",
|
||||
isSaving,
|
||||
onClose,
|
||||
onSubmit,
|
||||
@@ -31,7 +33,10 @@ export function FormModal({
|
||||
role="dialog"
|
||||
tabIndex={-1}
|
||||
>
|
||||
<div className="modal-dialog modal-lg modal-dialog-centered">
|
||||
<div
|
||||
className={`modal-dialog modal-dialog-centered ${dialogSize === "large" ? "modal-lg" : ""}`}
|
||||
style={dialogSize === "viewport" ? { maxWidth: "calc(100vw - 2rem)" } : undefined}
|
||||
>
|
||||
<form className="modal-content" onSubmit={onSubmit}>
|
||||
<div className="modal-header">
|
||||
<div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useMemo, useState, type FormEvent } from "react";
|
||||
import React, { useEffect, useMemo, useState, type FormEvent } from "react";
|
||||
import {
|
||||
createDefaultExternalCsvConfiguration,
|
||||
type ExternalCsvConfiguration,
|
||||
@@ -132,6 +132,7 @@ export function RevitCsvModal({
|
||||
return (
|
||||
<FormModal
|
||||
description="Projektweites Mapping speichern und Revit-CSV ohne Datenübernahme prüfen."
|
||||
dialogSize="viewport"
|
||||
isSaving={isSaving}
|
||||
onClose={onClose}
|
||||
onSubmit={handleSave}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { describe, it } from "node:test";
|
||||
import { createElement } from "react";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { RevitCsvModal } from "../src/frontend/components/revit-csv-modal.js";
|
||||
import {
|
||||
getExternalCsvConfiguration,
|
||||
previewExternalCsv,
|
||||
@@ -52,3 +55,19 @@ describe("Revit CSV frontend API", () => {
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Revit CSV modal presentation", () => {
|
||||
it("uses the viewport-wide dialog variant", () => {
|
||||
const markup = renderToStaticMarkup(
|
||||
createElement(RevitCsvModal, {
|
||||
currentRevision: 0,
|
||||
onClose: () => undefined,
|
||||
onRevisionChange: () => undefined,
|
||||
projectId: "project-1",
|
||||
})
|
||||
);
|
||||
|
||||
assert.match(markup, /max-width:calc\(100vw - 2rem\)/);
|
||||
assert.doesNotMatch(markup, /modal-lg/);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user