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

added preload for lab images

This commit is contained in:
Fedor Katurov 2021-10-12 15:26:49 +07:00
parent bcd1094575
commit 9dbc5739b7
2 changed files with 8 additions and 5 deletions

View file

@ -16,6 +16,8 @@ import { PRESETS } from '~/constants/urls';
import SwiperClass from 'swiper/types/swiper-class'; import SwiperClass from 'swiper/types/swiper-class';
import { useGotoNode } from '~/utils/hooks/node/useGotoNode'; import { useGotoNode } from '~/utils/hooks/node/useGotoNode';
import { Placeholder } from '~/components/placeholders/Placeholder'; import { Placeholder } from '~/components/placeholders/Placeholder';
import { normalizeBrightColor } from '~/utils/color';
import { ImagePreloader } from '~/components/media/ImagePreloader';
SwiperCore.use([Navigation, Pagination, A11y]); SwiperCore.use([Navigation, Pagination, A11y]);
@ -79,12 +81,12 @@ const LabImage: FC<IProps> = ({ node, isLoading }) => {
> >
{images.map(file => ( {images.map(file => (
<SwiperSlide className={styles.slide} key={file.id}> <SwiperSlide className={styles.slide} key={file.id}>
<img <ImagePreloader
className={styles.image} file={file}
src={getURL(file, PRESETS['1600'])}
alt={node.title}
onLoad={updateSwiper} onLoad={updateSwiper}
onClick={onClick} onClick={onClick}
className={styles.image}
color={normalizeBrightColor(file?.metadata?.dominant_color)}
/> />
</SwiperSlide> </SwiperSlide>
))} ))}

View file

@ -1,11 +1,12 @@
@import "~/styles/variables.scss"; @import "~/styles/variables.scss";
.wrapper { .wrapper {
border-radius: $radius;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
min-width: 0; min-width: 0;
border-radius: $radius $radius 0 0;
overflow: hidden;
:global(.swiper-container) { :global(.swiper-container) {
width: 100%; width: 100%;