Skip to content
This repository has been archived by the owner on Dec 21, 2022. It is now read-only.

Commit

Permalink
feat(image-web): remove old typings
Browse files Browse the repository at this point in the history
  • Loading branch information
Keraito committed Aug 31, 2021
1 parent f9034d0 commit 4fded29
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 72 deletions.
8 changes: 4 additions & 4 deletions packages/pluggableWidgets/image-web/src/Image.editorConfig.ts
Expand Up @@ -7,10 +7,10 @@ import {
StructurePreviewProps,
transformGroupsIntoTabs
} from "@mendix/piw-utils-internal";
import { DatasourceEnum, ImageViewerPreviewProps } from "../typings/ImageViewerProps";
import { DatasourceEnum, ImagePreviewProps } from "../typings/ImageProps";
import StructurePreviewImageViewerSvg from "./assets/placeholder.svg";

type ImageViewPreviewPropsKey = keyof ImageViewerPreviewProps;
type ImageViewPreviewPropsKey = keyof ImagePreviewProps;

const dataSourceProperties: ImageViewPreviewPropsKey[] = ["imageObject", "imageUrl", "imageIcon"];

Expand Down Expand Up @@ -40,7 +40,7 @@ function reorderTabsForStudio(tabs: Properties): void {
}

export function getProperties(
values: ImageViewerPreviewProps,
values: ImagePreviewProps,
defaultProperties: Properties,
platform: "web" | "desktop"
): Properties {
Expand Down Expand Up @@ -88,7 +88,7 @@ export function getPreview(): StructurePreviewProps | null {
};
}

export function check(values: ImageViewerPreviewProps): Problem[] {
export function check(values: ImagePreviewProps): Problem[] {
const errors: Problem[] = [];

if (values.datasource === "imageUrl" && !values.imageUrl) {
Expand Down
@@ -1,14 +1,14 @@
import { parseStyle } from "@mendix/piw-utils-internal";
import { WebIcon } from "mendix";
import { createElement, ReactElement } from "react";
import { ImageViewerPreviewProps } from "../typings/ImageViewerProps";
import { ImagePreviewProps } from "../typings/ImageProps";
import { ImageViewer as ImageViewerComponent } from "./components/Image/index";

import ImageViewerPlaceholder from "./assets/placeholder.svg";

declare function require(name: string): string;

export function preview(props: ImageViewerPreviewProps): ReactElement | null {
export function preview(props: ImagePreviewProps): ReactElement | null {
let image = ImageViewerPlaceholder;
switch (props.datasource) {
case "image":
Expand Down
6 changes: 3 additions & 3 deletions packages/pluggableWidgets/image-web/src/Image.tsx
@@ -1,6 +1,6 @@
import { ValueStatus } from "mendix";
import { createElement, FunctionComponent, useCallback } from "react";
import { ImageViewerContainerProps } from "../typings/ImageViewerProps";
import { ImageContainerProps } from "../typings/ImageProps";
import { ImageViewer as ImageViewerComponent, ImageViewerImageProps } from "./components/Image/index";

function getImageProps({
Expand All @@ -9,7 +9,7 @@ function getImageProps({
imageObject,
imageUrl,
defaultImageDynamic
}: ImageViewerContainerProps): ImageViewerImageProps {
}: ImageContainerProps): ImageViewerImageProps {
const fallback: ImageViewerImageProps = {
type: "image",
image: undefined
Expand Down Expand Up @@ -62,7 +62,7 @@ function getImageProps({
}
}

export const ImageViewer: FunctionComponent<ImageViewerContainerProps> = props => {
export const ImageViewer: FunctionComponent<ImageContainerProps> = props => {
const onClick = useCallback(() => props.onClick?.execute(), [props.onClick]);
const { type, image } = getImageProps(props);

Expand Down
@@ -1,5 +1,5 @@
import { cloneElement, createElement, CSSProperties, FunctionComponent, useCallback } from "react";
import { HeightUnitEnum, WidthUnitEnum, OnClickTypeEnum, DisplayAsEnum } from "../../../typings/ImageViewerProps";
import { HeightUnitEnum, WidthUnitEnum, OnClickTypeEnum, DisplayAsEnum } from "../../../typings/ImageProps";
import { useLightboxState } from "../../utils/lightboxState";
import { ImageViewerUi, ImageViewerContentProps } from "./ui";
import { Lightbox, LightboxProps } from "../Lightbox";
Expand Down
@@ -1,6 +1,6 @@
import { createElement, CSSProperties, HTMLAttributes, ReactElement, ReactEventHandler } from "react";
import classNames from "classnames";
import { HeightUnitEnum, WidthUnitEnum } from "../../../typings/ImageViewerProps";
import { HeightUnitEnum, WidthUnitEnum } from "../../../typings/ImageProps";
import { LightboxProps } from "../Lightbox";

import "../../ui/Image.scss";
Expand Down
4 changes: 2 additions & 2 deletions packages/pluggableWidgets/image-web/typings/ImageProps.d.ts
Expand Up @@ -42,8 +42,8 @@ export interface ImagePreviewProps {
class: string;
style: string;
datasource: DatasourceEnum;
imageObject: string;
defaultImageDynamic: string;
imageObject: { type: "static"; imageUrl: string; } | { type: "dynamic"; entity: string; } | null;
defaultImageDynamic: { type: "static"; imageUrl: string; } | { type: "dynamic"; entity: string; } | null;
imageUrl: string;
imageIcon: { type: "glyph"; iconClass: string; } | { type: "image"; imageUrl: string; } | null;
onClickType: OnClickTypeEnum;
Expand Down
59 changes: 0 additions & 59 deletions packages/pluggableWidgets/image-web/typings/ImageViewerProps.d.ts

This file was deleted.

0 comments on commit 4fded29

Please sign in to comment.