Widen Revit CSV dialog
This commit is contained in:
@@ -5,6 +5,7 @@ import React, { type FormEvent, type ReactNode } from "react";
|
|||||||
interface FormModalProps {
|
interface FormModalProps {
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
description?: string;
|
description?: string;
|
||||||
|
dialogSize?: "large" | "viewport";
|
||||||
isSaving: boolean;
|
isSaving: boolean;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
onSubmit: (event: FormEvent<HTMLFormElement>) => void;
|
onSubmit: (event: FormEvent<HTMLFormElement>) => void;
|
||||||
@@ -16,6 +17,7 @@ interface FormModalProps {
|
|||||||
export function FormModal({
|
export function FormModal({
|
||||||
children,
|
children,
|
||||||
description,
|
description,
|
||||||
|
dialogSize = "large",
|
||||||
isSaving,
|
isSaving,
|
||||||
onClose,
|
onClose,
|
||||||
onSubmit,
|
onSubmit,
|
||||||
@@ -31,7 +33,10 @@ export function FormModal({
|
|||||||
role="dialog"
|
role="dialog"
|
||||||
tabIndex={-1}
|
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}>
|
<form className="modal-content" onSubmit={onSubmit}>
|
||||||
<div className="modal-header">
|
<div className="modal-header">
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useEffect, useMemo, useState, type FormEvent } from "react";
|
import React, { useEffect, useMemo, useState, type FormEvent } from "react";
|
||||||
import {
|
import {
|
||||||
createDefaultExternalCsvConfiguration,
|
createDefaultExternalCsvConfiguration,
|
||||||
type ExternalCsvConfiguration,
|
type ExternalCsvConfiguration,
|
||||||
@@ -132,6 +132,7 @@ export function RevitCsvModal({
|
|||||||
return (
|
return (
|
||||||
<FormModal
|
<FormModal
|
||||||
description="Projektweites Mapping speichern und Revit-CSV ohne Datenübernahme prüfen."
|
description="Projektweites Mapping speichern und Revit-CSV ohne Datenübernahme prüfen."
|
||||||
|
dialogSize="viewport"
|
||||||
isSaving={isSaving}
|
isSaving={isSaving}
|
||||||
onClose={onClose}
|
onClose={onClose}
|
||||||
onSubmit={handleSave}
|
onSubmit={handleSave}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
import assert from "node:assert/strict";
|
import assert from "node:assert/strict";
|
||||||
import { describe, it } from "node:test";
|
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 {
|
import {
|
||||||
getExternalCsvConfiguration,
|
getExternalCsvConfiguration,
|
||||||
previewExternalCsv,
|
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