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 * 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.switcher}>
|
||||
<div />
|
||||
<div />
|
||||
<div />
|
||||
<div />
|
||||
{
|
||||
range(0, total).map((item) => (
|
||||
<div className={classNames({ is_active: item === current })} />
|
||||
))
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
width: 30px;
|
||||
height: 30px;
|
||||
box-sizing: border-box;
|
||||
opacity: .3;
|
||||
cursor: pointer;
|
||||
transition: opacity 0.25s;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
opacity: .5;
|
||||
transition: opacity 0.25s;
|
||||
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
|
@ -38,5 +38,11 @@
|
|||
border-radius: 8px;
|
||||
box-shadow: inset white 0 0 0 2px;
|
||||
}
|
||||
|
||||
&:global(.is_active) {
|
||||
&::after {
|
||||
background: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ interface IProps {}
|
|||
|
||||
const ImageExample: FC<IProps> = () => (
|
||||
<Card className={styles.node} seamless>
|
||||
<ImageSwitcher />
|
||||
<ImageSwitcher total={5} current={2} />
|
||||
|
||||
<div className={styles.image_container}>
|
||||
<img
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue