Fixed modal height to consider the entire modal when height is relative
This commit is contained in:
parent
532eaca071
commit
ab3a651e9a
3 changed files with 35 additions and 32 deletions
|
|
@ -4,7 +4,7 @@ export const switchCaseModalSize = (size: string) => {
|
||||||
switch (size) {
|
switch (size) {
|
||||||
case "x-small":
|
case "x-small":
|
||||||
minWidth = "min-w-[20vw]";
|
minWidth = "min-w-[20vw]";
|
||||||
height = "h-full";
|
height = "";
|
||||||
break;
|
break;
|
||||||
case "smaller":
|
case "smaller":
|
||||||
minWidth = "min-w-[40vw]";
|
minWidth = "min-w-[40vw]";
|
||||||
|
|
@ -12,7 +12,7 @@ export const switchCaseModalSize = (size: string) => {
|
||||||
break;
|
break;
|
||||||
case "smaller-h-full":
|
case "smaller-h-full":
|
||||||
minWidth = "min-w-[40vw]";
|
minWidth = "min-w-[40vw]";
|
||||||
height = "h-full";
|
height = "";
|
||||||
break;
|
break;
|
||||||
case "small":
|
case "small":
|
||||||
minWidth = "min-w-[40vw]";
|
minWidth = "min-w-[40vw]";
|
||||||
|
|
@ -20,16 +20,19 @@ export const switchCaseModalSize = (size: string) => {
|
||||||
break;
|
break;
|
||||||
case "small-h-full":
|
case "small-h-full":
|
||||||
minWidth = "min-w-[40vw]";
|
minWidth = "min-w-[40vw]";
|
||||||
height = "h-full";
|
height = "";
|
||||||
break;
|
break;
|
||||||
case "medium":
|
case "medium":
|
||||||
minWidth = "min-w-[60vw]";
|
minWidth = "min-w-[60vw]";
|
||||||
height = "h-[60vh]";
|
height = "h-[60vh]";
|
||||||
break;
|
break;
|
||||||
|
case "medium-tall":
|
||||||
|
minWidth = "min-w-[60vw]";
|
||||||
|
height = "h-[90vh]";
|
||||||
|
break;
|
||||||
case "medium-h-full":
|
case "medium-h-full":
|
||||||
minWidth = "min-w-[60vw]";
|
minWidth = "min-w-[60vw]";
|
||||||
height = "h-full";
|
height = "";
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "large":
|
case "large":
|
||||||
minWidth = "min-w-[85vw]";
|
minWidth = "min-w-[85vw]";
|
||||||
|
|
@ -56,11 +59,11 @@ export const switchCaseModalSize = (size: string) => {
|
||||||
|
|
||||||
case "large-h-full":
|
case "large-h-full":
|
||||||
minWidth = "min-w-[80vw]";
|
minWidth = "min-w-[80vw]";
|
||||||
height = "h-full";
|
height = "";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
minWidth = "min-w-[80vw]";
|
minWidth = "min-w-[80vw]";
|
||||||
height = "h-[80vh]";
|
height = "h-[90vh]";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return { minWidth, height };
|
return { minWidth, height };
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,7 @@ interface BaseModalProps {
|
||||||
| "smaller"
|
| "smaller"
|
||||||
| "small"
|
| "small"
|
||||||
| "medium"
|
| "medium"
|
||||||
|
| "medium-tall"
|
||||||
| "large"
|
| "large"
|
||||||
| "three-cards"
|
| "three-cards"
|
||||||
| "large-thin"
|
| "large-thin"
|
||||||
|
|
@ -180,7 +181,9 @@ function BaseModal({
|
||||||
) : (
|
) : (
|
||||||
<Dialog open={open} onOpenChange={setOpen}>
|
<Dialog open={open} onOpenChange={setOpen}>
|
||||||
{triggerChild}
|
{triggerChild}
|
||||||
<DialogContent className={cn(minWidth, "duration-300")}>
|
<DialogContent
|
||||||
|
className={cn(minWidth, height, "flex flex-col duration-300")}
|
||||||
|
>
|
||||||
<div className="truncate-doubleline word-break-break-word">
|
<div className="truncate-doubleline word-break-break-word">
|
||||||
{headerChild}
|
{headerChild}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -190,10 +193,10 @@ function BaseModal({
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
onSubmit();
|
onSubmit();
|
||||||
}}
|
}}
|
||||||
className="flex flex-col gap-6"
|
className="flex flex-1 flex-col gap-6"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className={`flex flex-col ${height} w-full transition-all duration-300`}
|
className={`flex w-full flex-1 flex-col transition-all duration-300`}
|
||||||
>
|
>
|
||||||
{ContentChild}
|
{ContentChild}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -204,7 +207,7 @@ function BaseModal({
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<div
|
<div
|
||||||
className={`flex flex-col ${height} w-full transition-all duration-300`}
|
className={`flex w-full flex-1 flex-col transition-all duration-300`}
|
||||||
>
|
>
|
||||||
{ContentChild}
|
{ContentChild}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ const EditNodeModal = forwardRef(
|
||||||
return (
|
return (
|
||||||
<BaseModal
|
<BaseModal
|
||||||
key={data.id}
|
key={data.id}
|
||||||
size="large-h-full"
|
size="medium-tall"
|
||||||
open={open}
|
open={open}
|
||||||
setOpen={setOpen}
|
setOpen={setOpen}
|
||||||
onChangeOpenModal={(open) => {
|
onChangeOpenModal={(open) => {
|
||||||
|
|
@ -85,6 +85,7 @@ const EditNodeModal = forwardRef(
|
||||||
<Badge variant="secondary">ID: {myData.current.id}</Badge>
|
<Badge variant="secondary">ID: {myData.current.id}</Badge>
|
||||||
</BaseModal.Header>
|
</BaseModal.Header>
|
||||||
<BaseModal.Content>
|
<BaseModal.Content>
|
||||||
|
<div className="flex h-full flex-col">
|
||||||
<div className="flex pb-2">
|
<div className="flex pb-2">
|
||||||
<IconComponent
|
<IconComponent
|
||||||
name="Variable"
|
name="Variable"
|
||||||
|
|
@ -93,20 +94,16 @@ const EditNodeModal = forwardRef(
|
||||||
<span className="edit-node-modal-span">Parameters</span>
|
<span className="edit-node-modal-span">Parameters</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="w-full">
|
<div className="h-full">
|
||||||
{nodeLength > 0 && (
|
{nodeLength > 0 && (
|
||||||
<div className="edit-node-modal-table">
|
|
||||||
<div className="h-96">
|
|
||||||
<TableComponent
|
<TableComponent
|
||||||
tooltipShowMode="whenTruncated"
|
|
||||||
tooltipShowDelay={0.5}
|
tooltipShowDelay={0.5}
|
||||||
columnDefs={columnDefs}
|
columnDefs={columnDefs}
|
||||||
rowData={rowData}
|
rowData={rowData}
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</BaseModal.Content>
|
</BaseModal.Content>
|
||||||
|
|
||||||
<BaseModal.Footer submit={{ label: "Save Changes" }} />
|
<BaseModal.Footer submit={{ label: "Save Changes" }} />
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue