Skip to content

Commit 89f98dd

Browse files
committed
adjust navigation buttons
1 parent e915346 commit 89f98dd

1 file changed

Lines changed: 41 additions & 18 deletions

File tree

src/components/VisualTour/VisualTour.tsx

Lines changed: 41 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import { createPopper } from "@popperjs/core";
55
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
66
import Badge from "../Badge/Badge";
77
import Button from "../Button/Button";
8-
import { Card, CardActions, CardContent, CardHeader, CardOptions, CardTitle } from "../Card";
8+
import { Card, CardActions, CardActionsAux, CardContent, CardHeader, CardOptions, CardTitle } from "../Card";
99
import { ModalSize, SimpleDialog } from "../Dialog";
10-
import Spacing from "../Separation/Spacing";
10+
import { IconButton } from "../Icon/index";
1111
import { TooltipSize } from "../Tooltip/Tooltip";
1212

1313
export interface VisualTourProps {
@@ -82,46 +82,69 @@ export const VisualTour = ({
8282
(elementToHighlight as HTMLElement).classList.add(highlightElementClass);
8383
(elementToHighlight as HTMLElement).scrollIntoView();
8484
}
85-
const titleOption = <Badge intent={"neutral"}>{` ${currentStepIndex + 1}/${steps.length} `}</Badge>;
85+
const stepDisplay = (
86+
<Badge tagProps={{ emphasis: "weaker" }} size="large">
87+
{` ${currentStepIndex + 1}/${steps.length} `}
88+
</Badge>
89+
);
90+
const closeButton = <IconButton name="navigation-close" text={closeLabel} onClick={onClose} />;
91+
const titleOptions = (
92+
<>
93+
{stepDisplay}
94+
{closeButton}
95+
</>
96+
);
8697
const actionButtons = [
87-
<Button key={"close"} onClick={onClose}>
88-
{closeLabel}
89-
</Button>,
9098
hasNextStep ? (
9199
<Button
92100
key={"next"}
101+
variant="outlined"
93102
intent={"primary"}
94103
onClick={() => {
95104
setCurrentStepIndex(currentStepIndex + 1);
96105
}}
106+
rightIcon={"navigation-next"}
97107
>
98108
{nextLabel}: {steps[currentStepIndex + 1].title}
99109
</Button>
100-
) : null,
101-
hasPreviousStep ? (
110+
) : (
102111
<Button
103-
key={"prev"}
104-
onClick={() => {
105-
setCurrentStepIndex(currentStepIndex - 1);
106-
}}
107-
>
108-
{prevLabel}
109-
</Button>
112+
key={"close"}
113+
text={closeLabel}
114+
onClick={onClose}
115+
variant="outlined"
116+
intent={"primary"}
117+
rightIcon={"navigation-close"}
118+
/>
119+
),
120+
hasPreviousStep ? (
121+
<CardActionsAux>
122+
<Button
123+
key={"prev"}
124+
variant="outlined"
125+
onClick={() => {
126+
setCurrentStepIndex(currentStepIndex - 1);
127+
}}
128+
icon={"navigation-previous"}
129+
>
130+
{prevLabel}
131+
</Button>
132+
</CardActionsAux>
110133
) : null,
111134
];
112135
// TODO: What to do if an element should have been highlighted, but none was found?
113136
if (elementToHighlight) {
114137
setCurrentStepComponent(
115138
<StepPopover
116139
highlightedElement={elementToHighlight}
117-
titleOption={titleOption}
140+
titleOption={titleOptions}
118141
actionButtons={actionButtons}
119142
step={step}
120143
/>
121144
);
122145
} else {
123146
setCurrentStepComponent(
124-
<StepModal titleOption={titleOption} actionButtons={actionButtons} step={step} onClose={onClose} />
147+
<StepModal titleOption={titleOptions} actionButtons={actionButtons} step={step} onClose={onClose} />
125148
);
126149
}
127150
return () => {
@@ -144,6 +167,7 @@ interface StepModalProps {
144167
}
145168

146169
// Main content of a step
170+
// FIXME: image size should be relative
147171
const StepContent = ({ step }: { step: VisualTourStep }) => {
148172
let width = "600";
149173
switch (step.size) {
@@ -160,7 +184,6 @@ const StepContent = ({ step }: { step: VisualTourStep }) => {
160184
return (
161185
<div>
162186
{step.image ? <img src={step.image} width={width} /> : null}
163-
<Spacing />
164187
{typeof step.content === "string" ? step.content : step.content()}
165188
</div>
166189
);

0 commit comments

Comments
 (0)