mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
added arrow navigation for swiper
This commit is contained in:
parent
983bf6f3e0
commit
c5288e0f80
5 changed files with 23 additions and 5 deletions
|
@ -11,7 +11,6 @@ const FlowRecent: FC<IProps> = ({ recent, updated }) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{updated && updated.map(node => <FlowRecentItem node={node} key={node.id} has_new />)}
|
{updated && updated.map(node => <FlowRecentItem node={node} key={node.id} has_new />)}
|
||||||
|
|
||||||
{recent && recent.map(node => <FlowRecentItem node={node} key={node.id} />)}
|
{recent && recent.map(node => <FlowRecentItem node={node} key={node.id} />)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
import React, { FC, useCallback, useEffect, useState } from 'react';
|
import React, { FC, useCallback, useEffect, useState } from 'react';
|
||||||
import { INodeComponentProps } from '~/redux/node/constants';
|
import { INodeComponentProps } from '~/redux/node/constants';
|
||||||
import SwiperCore, { A11y, Pagination, SwiperOptions } from 'swiper';
|
import SwiperCore, { A11y, Pagination, Navigation, SwiperOptions, Keyboard } from 'swiper';
|
||||||
import { Swiper, SwiperSlide } from 'swiper/react';
|
import { Swiper, SwiperSlide } from 'swiper/react';
|
||||||
|
|
||||||
import 'swiper/swiper.scss';
|
import 'swiper/swiper.scss';
|
||||||
import 'swiper/components/pagination/pagination.scss';
|
import 'swiper/components/pagination/pagination.scss';
|
||||||
import 'swiper/components/scrollbar/scrollbar.scss';
|
import 'swiper/components/scrollbar/scrollbar.scss';
|
||||||
import 'swiper/components/zoom/zoom.scss';
|
import 'swiper/components/zoom/zoom.scss';
|
||||||
|
import 'swiper/components/navigation/navigation.scss';
|
||||||
|
|
||||||
import styles from './styles.module.scss';
|
import styles from './styles.module.scss';
|
||||||
import { useNodeImages } from '~/utils/hooks/node/useNodeImages';
|
import { useNodeImages } from '~/utils/hooks/node/useNodeImages';
|
||||||
|
@ -16,13 +17,14 @@ import SwiperClass from 'swiper/types/swiper-class';
|
||||||
import { modalShowPhotoswipe } from '~/redux/modal/actions';
|
import { modalShowPhotoswipe } from '~/redux/modal/actions';
|
||||||
import { useDispatch } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
|
|
||||||
SwiperCore.use([Pagination, A11y]);
|
SwiperCore.use([Navigation, Pagination, A11y]);
|
||||||
|
|
||||||
interface IProps extends INodeComponentProps {}
|
interface IProps extends INodeComponentProps {}
|
||||||
|
|
||||||
const breakpoints: SwiperOptions['breakpoints'] = {
|
const breakpoints: SwiperOptions['breakpoints'] = {
|
||||||
599: {
|
599: {
|
||||||
spaceBetween: 20,
|
spaceBetween: 20,
|
||||||
|
navigation: true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -77,6 +79,10 @@ const NodeImageSwiperBlock: FC<IProps> = ({ node }) => {
|
||||||
watchOverflow
|
watchOverflow
|
||||||
updateOnImagesReady
|
updateOnImagesReady
|
||||||
onInit={resetSwiper}
|
onInit={resetSwiper}
|
||||||
|
keyboard={{
|
||||||
|
enabled: true,
|
||||||
|
onlyInViewport: false,
|
||||||
|
}}
|
||||||
zoom
|
zoom
|
||||||
>
|
>
|
||||||
{images.map(file => (
|
{images.map(file => (
|
||||||
|
|
|
@ -20,6 +20,17 @@
|
||||||
:global(.swiper-container) {
|
:global(.swiper-container) {
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:global(.swiper-button-next),
|
||||||
|
:global(.swiper-button-prev) {
|
||||||
|
color: white;
|
||||||
|
font-size: 10px;
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
font-size: 32px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.slide {
|
.slide {
|
||||||
|
|
|
@ -40,7 +40,7 @@ const NodeLayout: FC<IProps> = memo(
|
||||||
const { head, block } = useNodeBlocks(current, is_loading);
|
const { head, block } = useNodeBlocks(current, is_loading);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div className={styles.wrap}>
|
||||||
{head}
|
{head}
|
||||||
|
|
||||||
<Container>
|
<Container>
|
||||||
|
@ -64,7 +64,7 @@ const NodeLayout: FC<IProps> = memo(
|
||||||
</Container>
|
</Container>
|
||||||
|
|
||||||
<SidebarRouter prefix="/post:id" />
|
<SidebarRouter prefix="/post:id" />
|
||||||
</>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
align-items: stretch !important;
|
align-items: stretch !important;
|
||||||
|
background-color: red;
|
||||||
|
|
||||||
@include vertical_at_tablet;
|
@include vertical_at_tablet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue