1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46:40 +07:00

fixed window callers

This commit is contained in:
Fedor Katurov 2022-01-07 19:16:42 +07:00
parent ba2e610e01
commit 224c27b6f4
6 changed files with 55 additions and 26 deletions

View file

@ -11,6 +11,7 @@ import { LoaderCircle } from '~/components/input/LoaderCircle';
import { useHistory } from 'react-router';
import classNames from 'classnames';
import { IFlowNode } from '~/redux/types';
import { useWindowSize } from '~/hooks/dom/useWindowSize';
SwiperCore.use([EffectFade, Lazy, Autoplay, Navigation]);
@ -19,9 +20,13 @@ interface Props {
}
export const FlowSwiperHero: FC<Props> = ({ heroes }) => {
const { innerWidth } = useWindowSize();
const [controlledSwiper, setControlledSwiper] = useState<SwiperClass | undefined>(undefined);
const [currentIndex, setCurrentIndex] = useState(heroes.length);
const preset = useMemo(() => (window.innerWidth <= 768 ? PRESETS.cover : PRESETS.small_hero), []);
const preset = useMemo(() => (innerWidth <= 768 ? PRESETS.cover : PRESETS.small_hero), [
innerWidth,
]);
const history = useHistory();
const onNext = useCallback(() => {