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

fixed lab hover effect

This commit is contained in:
Fedor Katurov 2022-12-22 13:45:23 +06:00
parent 1d7c09aa7b
commit 77e8705f41
3 changed files with 40 additions and 9 deletions

View file

@ -6,19 +6,23 @@ import { DivProps } from '~/utils/types';
import styles from './styles.module.scss';
type HoverableEffect = 'rise' | 'shine';
interface HoverableProps extends DivProps {
icon?: ReactNode;
effect?: HoverableEffect;
}
const Hoverable: FC<HoverableProps> = ({
children,
className,
icon,
effect = 'rise',
...rest
}) => (
<div
{...rest}
className={classNames(styles.hoverable, className, {
className={classNames(styles.hoverable, styles[effect], className, {
[styles.with_icon]: !!icon,
})}
>

View file

@ -18,7 +18,10 @@
&.with_icon::after {
background: linear-gradient(325deg, $color_primary 20px, transparent 100px);
}
}
.hoverable.rise {
@media (hover: hover) {
&:hover {
z-index: 10;
transition: all 100ms;
@ -29,6 +32,30 @@
opacity: 1;
}
}
}
}
.hoverable.shine {
&::before {
content: '';
position: absolute;
inset: 0;
background: linear-gradient(
150deg,
#{transparentize(yellow, 0.75)},
transparent
);
z-index: 1;
border-radius: $radius;
opacity: 0;
pointer-events: none;
touch-action: none;
transition: all 250ms;
}
&:hover::before {
opacity: 1;
}
}
.icon {

View file

@ -23,7 +23,7 @@ const LabGrid: FC<IProps> = memo(() => {
<div className={styles.wrap}>
<Columns hasMore={hasMore && !isLoading} onScrollEnd={loadMore}>
{nodes.map((node) => (
<Hoverable key={node.node.id}>
<Hoverable key={node.node.id} effect="shine">
<LabNode
node={node.node}
lastSeen={node.last_seen}