-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathGlassCard.tsx
More file actions
42 lines (38 loc) · 1.3 KB
/
Copy pathGlassCard.tsx
File metadata and controls
42 lines (38 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
'use client';
import React, { ReactNode } from 'react';
import { motion, HTMLMotionProps } from 'framer-motion';
interface GlassCardProps extends HTMLMotionProps<'div'> {
children: ReactNode;
className?: string;
hoverable?: boolean;
}
export function GlassCard({
children,
className = '',
hoverable = true,
initial = { opacity: 0, y: 20 },
whileInView = { opacity: 1, y: 0 },
viewport = { once: true },
transition = { duration: 0.5 },
...props
}: GlassCardProps) {
const baseClasses =
'glass-panel relative overflow-hidden rounded-3xl text-[var(--fs-text-primary)] shadow-2xl';
const hoverClasses = hoverable
? 'transition-all duration-300 hover:-translate-y-1 hover:border-[var(--fs-primary)]/20'
: '';
return (
<motion.div
initial={initial}
whileInView={whileInView}
viewport={viewport}
transition={transition}
className={`${baseClasses} ${hoverClasses} ${className}`}
{...props}
>
<div className="absolute inset-0 bg-gradient-to-br from-[var(--fs-primary)]/8 via-transparent to-transparent pointer-events-none" />
<div className="relative z-10 p-5 md:p-7">{children}</div>
<div className="absolute top-0 left-0 right-0 h-px bg-gradient-to-r from-transparent via-[var(--fs-border)] to-transparent" />
</motion.div>
);
}