![]()
(
);
NextPrevButtons.propTypes = {
+ expanded: PropTypes.bool.isRequired,
isRtl: PropTypes.bool,
onNextStep: PropTypes.func,
onPrevStep: PropTypes.func
};
CardHeader.propTypes = {
+ expanded: PropTypes.bool.isRequired,
onCloseCards: PropTypes.func.isRequired,
onShowAll: PropTypes.func.isRequired,
+ onShrinkExpandCards: PropTypes.func.isRequired,
step: PropTypes.number,
totalSteps: PropTypes.number
};
@@ -219,6 +249,7 @@ const Cards = props => {
locale,
onActivateDeckFactory,
onCloseCards,
+ onShrinkExpandCards,
onDrag,
onStartDrag,
onEndDrag,
@@ -226,71 +257,95 @@ const Cards = props => {
onNextStep,
onPrevStep,
step,
+ expanded,
...posProps
} = props;
let {x, y} = posProps;
if (activeDeckId === null) return;
+ // Tutorial cards need to calculate their own dragging bounds
+ // to allow for dragging the cards off the left, right and bottom
+ // edges of the workspace.
+ const cardHorizontalDragOffset = 400; // ~80% of card width
+ const cardVerticalDragOffset = expanded ? 257 : 0; // ~80% of card height, if expanded
+ const menuBarHeight = 48; // TODO: get pre-calculated from elsewhere?
+ const wideCardWidth = 500;
+
if (x === 0 && y === 0) {
// initialize positions
- x = isRtl ? -292 : 292;
- // The tallest cards are about 385px high, and the default position is pinned
+ x = isRtl ? (-190 - wideCardWidth - cardHorizontalDragOffset) : 292;
+ x += cardHorizontalDragOffset;
+ // The tallest cards are about 320px high, and the default position is pinned
// to near the bottom of the blocks palette to allow room to work above.
- const tallCardHeight = 385;
+ const tallCardHeight = 320;
const bottomMargin = 60; // To avoid overlapping the backpack region
- y = window.innerHeight - tallCardHeight - bottomMargin;
+ y = window.innerHeight - tallCardHeight - bottomMargin - menuBarHeight;
}
const steps = content[activeDeckId].steps;
return (
-
-
-
-
-
- {steps[step].deckIds ? (
-
- ) : (
- steps[step].video ? (
-
+
+
+
+
+ {steps[step].deckIds ? (
+
) : (
-
- )
- )}
- {steps[step].trackingPixel && steps[step].trackingPixel}
+ steps[step].video ? (
+
+ ) : (
+
+ )
+ )}
+ {steps[step].trackingPixel && steps[step].trackingPixel}
+
+
0 ? onPrevStep : null}
+ />
-
0 ? onPrevStep : null}
- />
-
-
+
+
);
};
@@ -309,6 +364,7 @@ Cards.propTypes = {
})
}),
dragging: PropTypes.bool.isRequired,
+ expanded: PropTypes.bool.isRequired,
isRtl: PropTypes.bool.isRequired,
locale: PropTypes.string.isRequired,
onActivateDeckFactory: PropTypes.func.isRequired,
@@ -318,6 +374,7 @@ Cards.propTypes = {
onNextStep: PropTypes.func.isRequired,
onPrevStep: PropTypes.func.isRequired,
onShowAll: PropTypes.func,
+ onShrinkExpandCards: PropTypes.func.isRequired,
onStartDrag: PropTypes.func,
step: PropTypes.number.isRequired,
x: PropTypes.number,
diff --git a/src/components/cards/icon--close.svg b/src/components/cards/icon--close.svg
index a02ec1049..73c7b929f 100644
--- a/src/components/cards/icon--close.svg
+++ b/src/components/cards/icon--close.svg
@@ -1,17 +1,17 @@