fix: added fix for the height of the model content to not overflow on smaller devices

This commit is contained in:
Erik Tiekstra
2024-10-17 07:41:03 +02:00
parent 4c1ee66542
commit babb66d989
5 changed files with 2111 additions and 1796 deletions

3857
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,17 +1,17 @@
import { useState, useEffect, ChangeEvent } from "react"
import { import {
ModalFooter,
ModalBody,
ModalHeader,
ButtonGroup,
Button, Button,
ButtonGroup,
Field as FieldComponent, Field as FieldComponent,
FieldLabel, FieldLabel,
ModalBody,
ModalFooter,
ModalHeader,
TextInput, TextInput,
} from "@contentstack/venus-components" } from "@contentstack/venus-components"
import { ChangeEvent, useEffect, useState } from "react"
import type { FocalPoint, InsertResponse } from "~/types/imagevault"
import FocalPointPicker from "~/shared-components/FocalPointPicker" import FocalPointPicker from "~/shared-components/FocalPointPicker"
import type { FocalPoint, InsertResponse } from "~/types/imagevault"
type ImageEditModalProps = { type ImageEditModalProps = {
fieldData: InsertResponse fieldData: InsertResponse
@@ -86,7 +86,9 @@ export default function ImageEditModal({
gap: "1rem", gap: "1rem",
alignItems: "center", alignItems: "center",
width: "auto", width: "auto",
maxHeight: "none", maxHeight: "calc(90dvh - 124px)", // 124px is the height of the header and footer
maxWidth: "90dvw",
overflow: "auto",
}} }}
> >
<FocalPointPicker <FocalPointPicker

View File

@@ -7,18 +7,18 @@ import {
FieldLabel, FieldLabel,
cbModal, cbModal,
} from "@contentstack/venus-components" } from "@contentstack/venus-components"
import ImageEditModal from "./ImageEditModal"
import FullSizeImage from "./FullSizeImage"
import { isInsertResponse, openImageVault } from "~/utils/imagevault" import { isInsertResponse, openImageVault } from "~/utils/imagevault"
import FullSizeImage from "./FullSizeImage"
import ImageEditModal from "./ImageEditModal"
import type { CbModalProps } from "@contentstack/venus-components/build/components/Modal/Modal"
import type UiLocation from "@contentstack/app-sdk/dist/src/uiLocation" import type UiLocation from "@contentstack/app-sdk/dist/src/uiLocation"
import type { CbModalProps } from "@contentstack/venus-components/build/components/Modal/Modal"
import type { InsertResponse } from "~/types/imagevault" import type { InsertResponse } from "~/types/imagevault"
import type { Lang } from "~/types/lang"
import type { import type {
EntryDataPublishDetails, EntryDataPublishDetails,
ImageVaultDAMConfig, ImageVaultDAMConfig,
} from "~/utils/imagevault" } from "~/utils/imagevault"
import type { Lang } from "~/types/lang"
export type ImageVaultDAMProps = { export type ImageVaultDAMProps = {
sdk: UiLocation sdk: UiLocation
@@ -177,6 +177,7 @@ export default function ImageVaultDAM({
style: { style: {
content: { content: {
maxHeight: "90dvh", maxHeight: "90dvh",
maxWidth: "90dvw",
width: "auto", width: "auto",
}, },
overlay: {}, overlay: {},

View File

@@ -1,20 +1,20 @@
import React, { useState, useEffect, ChangeEvent } from "react"
import { import {
ModalFooter,
ModalBody,
ModalHeader,
ButtonGroup,
Button, Button,
ButtonGroup,
Field, Field,
FieldLabel, FieldLabel,
TextInput, ModalBody,
ModalFooter,
ModalHeader,
Select, Select,
TextInput,
} from "@contentstack/venus-components" } from "@contentstack/venus-components"
import React, { ChangeEvent, useEffect, useState } from "react"
import { Path } from "slate" import { Path } from "slate"
import type { import type {
IRteParam,
IRteElementType, IRteElementType,
IRteParam,
} from "@contentstack/app-sdk/dist/src/RTE/types" } from "@contentstack/app-sdk/dist/src/RTE/types"
import FocalPointPicker from "~/shared-components/FocalPointPicker" import FocalPointPicker from "~/shared-components/FocalPointPicker"
@@ -166,7 +166,9 @@ export default function ImageEditModal({
gap: "1rem", gap: "1rem",
alignItems: "center", alignItems: "center",
width: "auto", width: "auto",
maxHeight: "none", maxHeight: "calc(90dvh - 124px)", // 124px is the height of the header and footer
maxWidth: "90dvw",
overflow: "auto",
}} }}
> >
<FocalPointPicker <FocalPointPicker

View File

@@ -1,13 +1,13 @@
import React, { useRef, useCallback, PropsWithChildren } from "react" import { Icon, Tooltip, cbModal } from "@contentstack/venus-components"
import { Tooltip, Icon, cbModal } from "@contentstack/venus-components" import React, { PropsWithChildren, useCallback, useRef } from "react"
import { Resizable } from "re-resizable" import { Resizable } from "re-resizable"
import EmbedBtn from "./EmbedBtn" import EmbedBtn from "./EmbedBtn"
import ImageEditModal from "./ImageEditModal" import ImageEditModal from "./ImageEditModal"
import type { import type {
IRteParam,
IRteElementType, IRteElementType,
IRteParam,
} from "@contentstack/app-sdk/dist/src/RTE/types" } from "@contentstack/app-sdk/dist/src/RTE/types"
import type { InsertResponse } from "~/types/imagevault" import type { InsertResponse } from "~/types/imagevault"
@@ -38,6 +38,7 @@ export function ImageElement({ children, element, rte }: ImageElementProps) {
style: { style: {
content: { content: {
maxHeight: "90dvh", maxHeight: "90dvh",
maxWidth: "90dvw",
width: "auto", width: "auto",
}, },
overlay: {}, overlay: {},