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

arrows markup

This commit is contained in:
Fedor Katurov 2020-04-27 19:20:02 +07:00
parent 25a59bf944
commit ada2e59676
2 changed files with 114 additions and 43 deletions

View file

@ -10,6 +10,7 @@ import { PRESETS } from '~/constants/urls';
import { LoaderCircle } from '~/components/input/LoaderCircle'; import { LoaderCircle } from '~/components/input/LoaderCircle';
import { throttle } from 'throttle-debounce'; import { throttle } from 'throttle-debounce';
import * as MODAL_ACTIONS from '~/redux/modal/actions'; import * as MODAL_ACTIONS from '~/redux/modal/actions';
import { Icon } from '~/components/input/Icon';
interface IProps { interface IProps {
is_loading: boolean; is_loading: boolean;
@ -183,7 +184,7 @@ const NodeImageSlideBlock: FC<IProps> = ({
setIsDragging(false); setIsDragging(false);
normalizeOffset(); normalizeOffset();
if (Math.abs(new Date().getTime() - drag_start) < 200 && initial_x - getX(event) < 50) { if (Math.abs(new Date().getTime() - drag_start) < 200 && initial_x - getX(event) < 20) {
onOpenPhotoSwipe(); onOpenPhotoSwipe();
} }
}, },
@ -233,7 +234,8 @@ const NodeImageSlideBlock: FC<IProps> = ({
); );
return ( return (
<div className={classNames(styles.wrap, { [styles.is_loading]: is_loading })} ref={wrap}> <div className={styles.wrap}>
<div className={classNames(styles.cutter, { [styles.is_loading]: is_loading })} ref={wrap}>
<div <div
className={classNames(styles.placeholder, { className={classNames(styles.placeholder, {
[styles.is_loading]: is_loading || !loaded[current], [styles.is_loading]: is_loading || !loaded[current],
@ -276,14 +278,33 @@ const NodeImageSlideBlock: FC<IProps> = ({
))} ))}
</div> </div>
{!is_loading && ( {images.length > 1 && (
<div className={styles.image_count}>
{current + 1}
<small> / </small>
{images.length}
</div>
)}
{/*
!is_loading && (
<ImageSwitcher <ImageSwitcher
total={images.length} total={images.length}
current={current} current={current}
onChange={changeCurrent} onChange={changeCurrent}
loaded={loaded} loaded={loaded}
/> />
)} )
*/}
</div>
<div className={classNames(styles.image_arrow)}>
<Icon icon="left" size={40} />
</div>
<div className={classNames(styles.image_arrow, styles.image_arrow_right)}>
<Icon icon="right" size={40} />
</div>
</div> </div>
); );
}; };

View file

@ -1,4 +1,8 @@
.wrap { .wrap {
position: relative;
}
.cutter {
overflow: hidden; overflow: hidden;
position: relative; position: relative;
min-width: 0; min-width: 0;
@ -52,12 +56,58 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding: 0 $gap / 2; padding: 0 $gap / 2;
position: relative;
&:global(.is_active) { &:global(.is_active) {
opacity: 1; opacity: 1;
} }
} }
.image_count {
position: absolute;
color: transparentize(white, 0.5);
bottom: $gap * 3;
right: 50%;
padding: $gap / 2 $gap * 1.2;
border-radius: 20px;
background: $content_bg;
font: $font_14_semibold;
transform: translate(50%, 0);
display: flex;
align-items: center;
justify-content: center;
user-select: none;
small {
font-size: 0.8em;
padding: 0 5px;
}
}
.image_arrow {
position: absolute;
left: -$gap;
top: 50%;
width: 40px;
height: 64px;
border-radius: $radius;
display: flex;
align-items: center;
justify-content: center;
transform: translate(-100%, -50%);
&_right {
right: -$gap;
left: auto;
transform: translate(100%, -50%);
}
svg {
position: relative;
left: -2px;
}
}
.placeholder { .placeholder {
position: absolute; position: absolute;
width: 100%; width: 100%;