Skip to content

Commit

Permalink
setTimeout 0 onArrowClick
Browse files Browse the repository at this point in the history
  • Loading branch information
liatv committed Feb 21, 2024
1 parent 6c55d10 commit 204facb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 64 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,8 @@ jobs:
cache: 'npm'
- run: npm ci
- run: npm run lint
tests:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.13.0]
test-script: ["ci:test-unit", "ci:test-e2e-layouts","ci:test-e2e-styleParams", "ci:test-e2e-integration"]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v2
- name: Install, build and run test
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build
- run: npm run ${{ matrix.test-script }}
env:
SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }}
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
TEST_NAME: ${{ matrix.test-script }}

deploy:
runs-on: ubuntu-latest
needs: [lint, tests]
strategy:
matrix:
node-version: [16.13.0]
Expand Down Expand Up @@ -89,7 +66,6 @@ jobs:
update-playground:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
needs: [lint, tests]
strategy:
matrix:
node-version: [16.13.0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import React from 'react';
import * as ReactDOM from 'react-dom';
import { GALLERY_CONSTS, utils } from 'pro-gallery-lib';
import { ArrowFollower } from '../../helpers/mouseCursorPosition';
import {
getArrowBoxStyle,
getArrowsRenderData,
} from '../../helpers/navigationArrowUtils';
import { getArrowBoxStyle, getArrowsRenderData } from '../../helpers/navigationArrowUtils';

Check failure on line 5 in packages/gallery/src/components/gallery/proGallery/navigationArrows.js

View workflow job for this annotation

GitHub Actions / lint (16.13.0)

Replace `·getArrowBoxStyle,·getArrowsRenderData·` with `⏎··getArrowBoxStyle,⏎··getArrowsRenderData,⏎`

export function NavigationArrows({
options,
Expand Down Expand Up @@ -45,8 +42,7 @@ export function NavigationArrows({
arrowsType: layoutParams.navigationArrows.type,
containerStyleType: type,
});
const mouseCursorEnabled =
arrowsPosition === GALLERY_CONSTS.arrowsPosition.MOUSE_CURSOR;
const mouseCursorEnabled = arrowsPosition === GALLERY_CONSTS.arrowsPosition.MOUSE_CURSOR;

Check failure on line 45 in packages/gallery/src/components/gallery/proGallery/navigationArrows.js

View workflow job for this annotation

GitHub Actions / lint (16.13.0)

Insert `⏎···`

const { galleryHeight } = container;
const { galleryWidth } = container;
Expand All @@ -67,10 +63,8 @@ export function NavigationArrows({
}
const verticalPositionFix = {
[GALLERY_CONSTS.arrowsVerticalPosition.ITEM_CENTER]: 0,
[GALLERY_CONSTS.arrowsVerticalPosition.IMAGE_CENTER]:
infoHeight * directionFix,
[GALLERY_CONSTS.arrowsVerticalPosition.INFO_CENTER]:
-imageHeight * directionFix,
[GALLERY_CONSTS.arrowsVerticalPosition.IMAGE_CENTER]: infoHeight * directionFix,

Check failure on line 66 in packages/gallery/src/components/gallery/proGallery/navigationArrows.js

View workflow job for this annotation

GitHub Actions / lint (16.13.0)

Insert `⏎·····`
[GALLERY_CONSTS.arrowsVerticalPosition.INFO_CENTER]: -imageHeight * directionFix,

Check failure on line 67 in packages/gallery/src/components/gallery/proGallery/navigationArrows.js

View workflow job for this annotation

GitHub Actions / lint (16.13.0)

Insert `⏎·····`
}[arrowsVerticalPosition];
const arrowBoxStyle = getArrowBoxStyle({
type,
Expand All @@ -90,9 +84,7 @@ export function NavigationArrows({
width: `${navArrowsContainerWidth}px`,
height: `${navArrowsContainerHeight}px`,
padding: 0,
top: `calc(${galleryVerticalCenter} - ${
navArrowsContainerHeight / 2
}px -
top: `calc(${galleryVerticalCenter} - ${navArrowsContainerHeight / 2}px -

Check failure on line 87 in packages/gallery/src/components/gallery/proGallery/navigationArrows.js

View workflow job for this annotation

GitHub Actions / lint (16.13.0)

Replace `navArrowsContainerHeight·/·2` with `⏎··········navArrowsContainerHeight·/·2⏎········`
${verticalPositionFix / 2}px)`,
...arrowBoxStyle,
};
Expand All @@ -117,9 +109,7 @@ export function NavigationArrows({
];
const navigationArrowPortalId = `arrow-portal-container-${id}`;

const ArrowRenderHandler = mouseCursorEnabled
? ArrowButtonWithCursorController
: ArrowButton;
const ArrowRenderHandler = mouseCursorEnabled ? ArrowButtonWithCursorController : ArrowButton;

Check failure on line 112 in packages/gallery/src/components/gallery/proGallery/navigationArrows.js

View workflow job for this annotation

GitHub Actions / lint (16.13.0)

Replace `·?·ArrowButtonWithCursorController` with `⏎····?·ArrowButtonWithCursorController⏎···`
const renderArrow = (directionIsLeft) => {
return (
<ArrowRenderHandler
Expand Down Expand Up @@ -180,7 +170,9 @@ export function ArrowButton({

const buttonProps = {
className: arrowsBaseClasses.join(' '),
onClick: () => next({ direction: directionIsLeft ? -1 : 1 }),
onClick: () => {
setTimeout(next({ direction: directionIsLeft ? -1 : 1 }), 0);
},
['aria-label']: `${isNext ? 'Next' : 'Previous'} Item`,
tabIndex: tabIndex(isNext ? 'slideshowNext' : 'slideshowPrev'),
key: !isNext ? 'nav-arrow-back' : 'nav-arrow-next',
Expand Down Expand Up @@ -212,22 +204,11 @@ export function ArrowButton({
</button>
);
}
return (
<button {...buttonProps}>
{renderArrowSvg(directionIsLeft ? 'left' : 'right')}
</button>
);
return <button {...buttonProps}>{renderArrowSvg(directionIsLeft ? 'left' : 'right')}</button>;

Check failure on line 207 in packages/gallery/src/components/gallery/proGallery/navigationArrows.js

View workflow job for this annotation

GitHub Actions / lint (16.13.0)

Replace `<button·{...buttonProps}>{renderArrowSvg(directionIsLeft·?·'left'·:·'right')}</button>` with `(⏎····<button·{...buttonProps}>⏎······{renderArrowSvg(directionIsLeft·?·'left'·:·'right')}⏎····</button>⏎··)`
}

export function ArrowButtonWithCursorController(props) {
const {
directionIsLeft,
next,
mouseCursorContainerMaxWidth,
hideLeftArrow,
hideRightArrow,
renderArrowSvg,
} = props;
const { directionIsLeft, next, mouseCursorContainerMaxWidth, hideLeftArrow, hideRightArrow, renderArrowSvg } = props;

Check failure on line 211 in packages/gallery/src/components/gallery/proGallery/navigationArrows.js

View workflow job for this annotation

GitHub Actions / lint (16.13.0)

Replace `·directionIsLeft,·next,·mouseCursorContainerMaxWidth,·hideLeftArrow,·hideRightArrow,·renderArrowSvg` with `⏎····directionIsLeft,⏎····next,⏎····mouseCursorContainerMaxWidth,⏎····hideLeftArrow,⏎····hideRightArrow,⏎····renderArrowSvg,⏎·`
const isTheOnlyArrow = hideLeftArrow || hideRightArrow;
return (
<ArrowFollower
Expand Down Expand Up @@ -264,11 +245,7 @@ export function ArrowsContainer({
}) {
if (mouseCursorEnabled) {
const styleForMouseCursor = {
justifyContent: hideLeftArrow
? 'flex-end'
: hideRightArrow
? 'flex-start'
: 'space-between',
justifyContent: hideLeftArrow ? 'flex-end' : hideRightArrow ? 'flex-start' : 'space-between',

Check failure on line 248 in packages/gallery/src/components/gallery/proGallery/navigationArrows.js

View workflow job for this annotation

GitHub Actions / lint (16.13.0)

Replace `·?·'flex-end'·:·hideRightArrow·?·'flex-start'` with `⏎········?·'flex-end'⏎········:·hideRightArrow⏎········?·'flex-start'⏎·······`
flexDirection: isRTL ? 'row-reverse' : 'row',
};
return (
Expand All @@ -279,9 +256,5 @@ export function ArrowsContainer({
</div>
);
}
return React.Fragment ? (
<React.Fragment>{children}</React.Fragment>
) : (
<div>{children}</div>
);
return React.Fragment ? <React.Fragment>{children}</React.Fragment> : <div>{children}</div>;

Check failure on line 259 in packages/gallery/src/components/gallery/proGallery/navigationArrows.js

View workflow job for this annotation

GitHub Actions / lint (16.13.0)

Replace `<React.Fragment>{children}</React.Fragment>·:·<div>{children}</div>` with `(⏎····<React.Fragment>{children}</React.Fragment>⏎··)·:·(⏎····<div>{children}</div>⏎··)`
}

0 comments on commit 204facb

Please sign in to comment.