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

NodeImageBlock resizes to content

This commit is contained in:
muerwre 2019-08-25 17:29:26 +07:00
parent a0272f5baa
commit 1299a0e766
5 changed files with 79 additions and 14 deletions

View file

@ -7,13 +7,18 @@ import classNames = require('classnames');
interface IProps {
total: number;
current: number;
onChange: (current: number) => void;
}
const ImageSwitcher: FC<IProps> = ({ total, current }) => (
const ImageSwitcher: FC<IProps> = ({ total, current, onChange }) => (
<div className={styles.wrap}>
<div className={styles.switcher}>
{range(0, total).map(item => (
<div className={classNames({ is_active: item === current })} key={item} />
<div
className={classNames({ is_active: item === current })}
key={item}
onClick={() => onChange(item)}
/>
))}
</div>
</div>

View file

@ -2,6 +2,7 @@
width: 100%;
height: 0;
position: relative;
z-index: 2;
}
.switcher {
@ -22,7 +23,7 @@
display: flex;
align-items: center;
justify-content: center;
opacity: .5;
opacity: 0.5;
transition: opacity 0.25s;
&:hover {