mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
changed image switcher appearance
This commit is contained in:
parent
a68c752325
commit
c7581e976e
3 changed files with 22 additions and 8 deletions
|
@ -1,13 +1,21 @@
|
||||||
import React, { FC } from 'react';
|
import React, { FC } from 'react';
|
||||||
import * as styles from './styles.scss';
|
import * as styles from './styles.scss';
|
||||||
|
import range from 'ramda/es/range';
|
||||||
|
import classNames = require("classnames");
|
||||||
|
|
||||||
const ImageSwitcher: FC<{}> = () => (
|
interface IProps {
|
||||||
|
total: number;
|
||||||
|
current: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ImageSwitcher: FC<IProps> = ({ total, current }) => (
|
||||||
<div className={styles.wrap}>
|
<div className={styles.wrap}>
|
||||||
<div className={styles.switcher}>
|
<div className={styles.switcher}>
|
||||||
<div />
|
{
|
||||||
<div />
|
range(0, total).map((item) => (
|
||||||
<div />
|
<div className={classNames({ is_active: item === current })} />
|
||||||
<div />
|
))
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -18,12 +18,12 @@
|
||||||
width: 30px;
|
width: 30px;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
opacity: .3;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: opacity 0.25s;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
opacity: .5;
|
||||||
|
transition: opacity 0.25s;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
@ -38,5 +38,11 @@
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
box-shadow: inset white 0 0 0 2px;
|
box-shadow: inset white 0 0 0 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:global(.is_active) {
|
||||||
|
&::after {
|
||||||
|
background: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ interface IProps {}
|
||||||
|
|
||||||
const ImageExample: FC<IProps> = () => (
|
const ImageExample: FC<IProps> = () => (
|
||||||
<Card className={styles.node} seamless>
|
<Card className={styles.node} seamless>
|
||||||
<ImageSwitcher />
|
<ImageSwitcher total={5} current={2} />
|
||||||
|
|
||||||
<div className={styles.image_container}>
|
<div className={styles.image_container}>
|
||||||
<img
|
<img
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue