mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
fixed lab hover effect
This commit is contained in:
parent
1d7c09aa7b
commit
77e8705f41
3 changed files with 40 additions and 9 deletions
|
@ -6,19 +6,23 @@ import { DivProps } from '~/utils/types';
|
||||||
|
|
||||||
import styles from './styles.module.scss';
|
import styles from './styles.module.scss';
|
||||||
|
|
||||||
|
type HoverableEffect = 'rise' | 'shine';
|
||||||
|
|
||||||
interface HoverableProps extends DivProps {
|
interface HoverableProps extends DivProps {
|
||||||
icon?: ReactNode;
|
icon?: ReactNode;
|
||||||
|
effect?: HoverableEffect;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Hoverable: FC<HoverableProps> = ({
|
const Hoverable: FC<HoverableProps> = ({
|
||||||
children,
|
children,
|
||||||
className,
|
className,
|
||||||
icon,
|
icon,
|
||||||
|
effect = 'rise',
|
||||||
...rest
|
...rest
|
||||||
}) => (
|
}) => (
|
||||||
<div
|
<div
|
||||||
{...rest}
|
{...rest}
|
||||||
className={classNames(styles.hoverable, className, {
|
className={classNames(styles.hoverable, styles[effect], className, {
|
||||||
[styles.with_icon]: !!icon,
|
[styles.with_icon]: !!icon,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
|
|
|
@ -18,7 +18,10 @@
|
||||||
&.with_icon::after {
|
&.with_icon::after {
|
||||||
background: linear-gradient(325deg, $color_primary 20px, transparent 100px);
|
background: linear-gradient(325deg, $color_primary 20px, transparent 100px);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.hoverable.rise {
|
||||||
|
@media (hover: hover) {
|
||||||
&:hover {
|
&:hover {
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
transition: all 100ms;
|
transition: all 100ms;
|
||||||
|
@ -30,6 +33,30 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.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 {
|
.icon {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
|
@ -23,7 +23,7 @@ const LabGrid: FC<IProps> = memo(() => {
|
||||||
<div className={styles.wrap}>
|
<div className={styles.wrap}>
|
||||||
<Columns hasMore={hasMore && !isLoading} onScrollEnd={loadMore}>
|
<Columns hasMore={hasMore && !isLoading} onScrollEnd={loadMore}>
|
||||||
{nodes.map((node) => (
|
{nodes.map((node) => (
|
||||||
<Hoverable key={node.node.id}>
|
<Hoverable key={node.node.id} effect="shine">
|
||||||
<LabNode
|
<LabNode
|
||||||
node={node.node}
|
node={node.node}
|
||||||
lastSeen={node.last_seen}
|
lastSeen={node.last_seen}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue