Skip to content

Commit 52d7fcc

Browse files
committed
improve dislay of text content and image
1 parent 72b0e97 commit 52d7fcc

2 files changed

Lines changed: 33 additions & 25 deletions

File tree

src/components/VisualTour/VisualTour.tsx

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,23 @@ import { Classes as BlueprintClasses } from "@blueprintjs/core";
44
import { createPopper } from "@popperjs/core";
55

66
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
7-
import Badge from "../Badge/Badge";
8-
import Button from "../Button/Button";
9-
import { Card, CardActions, CardActionsAux, CardContent, CardHeader, CardOptions, CardTitle } from "../Card";
10-
import { ModalSize, SimpleDialog } from "../Dialog";
11-
import { IconButton } from "../Icon/index";
12-
import { TooltipSize } from "../Tooltip/Tooltip";
7+
import {
8+
Badge,
9+
Button,
10+
Card,
11+
CardActions,
12+
CardActionsAux,
13+
CardContent,
14+
CardHeader,
15+
CardOptions,
16+
CardTitle,
17+
IconButton,
18+
Markdown,
19+
ModalSize,
20+
SimpleDialog,
21+
Spacing,
22+
TooltipSize,
23+
} from "../../index";
1324

1425
export interface VisualTourProps {
1526
/** The steps of the tour. */
@@ -171,25 +182,20 @@ interface StepModalProps {
171182
}
172183

173184
// Main content of a step
174-
// FIXME: image size should be relative
175185
const StepContent = ({ step }: { step: VisualTourStep }) => {
176-
let width = "600";
177-
switch (step.size) {
178-
case "large":
179-
width = "800";
180-
break;
181-
case "xlarge":
182-
width = "1000";
183-
break;
184-
case "fullscreen":
185-
width = "1200";
186-
break;
187-
}
188186
return (
189-
<div>
190-
{step.image ? <img src={step.image} width={width} /> : null}
191-
{typeof step.content === "string" ? step.content : step.content()}
192-
</div>
187+
<>
188+
{step.image && (
189+
<>
190+
<img
191+
src={step.image}
192+
style={{ height: "auto", width: "auto", maxHeight: "30vh", maxWidth: "100%" }}
193+
/>
194+
<Spacing size="small" />
195+
</>
196+
)}
197+
{typeof step.content === "string" ? <Markdown>{step.content}</Markdown> : step.content()}
198+
</>
193199
);
194200
};
195201

src/components/VisualTour/stories/defaultTour.de.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ const definition = {
2222
content: "Kontextoverlay für ein anderes hervorgehobenes Element.",
2323
},
2424
highlightElementLeft: {
25-
title: "Element auf der linken Seite hervorheben",
25+
title: "Element auf der linken Seite hervorheben & Bild hochkant",
26+
image: "https://upload.wikimedia.org/wikipedia/commons/a/a3/Knowledge_graph_installation_at_the_Futurium_Berlin_21.jpg",
2627
content: "Der Tooltip wird dort plaziert, wo er am besten für den Benutzer zu sehen ist.",
2728
},
2829
highlightElementC: {
29-
title: "Element C hervorheben",
30+
title: "Element C hervorheben & Bild landscape",
31+
image: "https://upload.wikimedia.org/wikipedia/commons/1/15/Knowledge_graph_installation_at_the_Futurium_Berlin.jpg",
3032
content: "Element ist außerhalb des Tourcontainers.",
3133
},
3234
highlightElementD: {

0 commit comments

Comments
 (0)