Skip to content

Commit

Permalink
Fix: Show standard mobile buttons on _hasNavigationInTextArea (fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverfoster authored Sep 29, 2023
1 parent a717f09 commit 3392e4d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion js/NarrativeView.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,20 @@ class NarrativeView extends ComponentView {
const mode = device.isScreenSizeMin('medium') ? MODE.LARGE : MODE.SMALL;
this.model.set('_mode', mode);
this.model.set('_isLargeMode', mode === MODE.LARGE);
return mode;
}

renderMode() {
this.calculateMode();
const mode = this.calculateMode();
this.setupEventListeners();

const isTextBelowImage = this.isTextBelowImage();
this.model.set('_isTextBelowImageResolved', isTextBelowImage);

const isLargeMode = (mode === MODE.LARGE);
const isSmallModeAndTextBelowImage = (mode === MODE.SMALL && isTextBelowImage);
const hasNavigationInTextArea = this.model.get('_hasNavigationInTextArea') && (isLargeMode || isSmallModeAndTextBelowImage);
this.model.set('_hasNavigationInTextAreaResolved', hasNavigationInTextArea);
}

isLargeMode() {
Expand Down
4 changes: 2 additions & 2 deletions templates/narrative.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { templates, classes } from 'core/js/reactHelpers';
export default function Narrative(props) {

const {
_hasNavigationInTextArea,
_hasNavigationInTextAreaResolved,
_isLargeMode,
_isStackedOnMobile,
_isTextBelowImageResolved
Expand All @@ -23,7 +23,7 @@ export default function Narrative(props) {

<div className={classes([
'component__widget narrative__widget',
_hasNavigationInTextArea && 'narrative__text-controls'
_hasNavigationInTextAreaResolved && 'narrative__text-controls'
])}
>

Expand Down

0 comments on commit 3392e4d

Please sign in to comment.