@aws505/sheetsite 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +185 -40
- package/dist/components/index.js +804 -57
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +789 -57
- package/dist/components/index.mjs.map +1 -1
- package/dist/index.js +175 -59
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +165 -59
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/index.ts +12 -0
- package/src/components/sections/BeforeAfter.tsx +345 -0
- package/src/components/sections/FAQ.tsx +3 -3
- package/src/components/sections/Gallery.tsx +104 -4
- package/src/components/sections/Menu.tsx +312 -0
- package/src/components/sections/Services.tsx +3 -3
- package/src/components/sections/Testimonials.tsx +1 -1
- package/src/components/sections/TrustBadges.tsx +283 -0
- package/src/components/ui/AnimatedSection.tsx +136 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Animated Section Component
|
|
3
|
+
*
|
|
4
|
+
* A wrapper component that adds scroll-triggered animations to its children.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use client';
|
|
8
|
+
|
|
9
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
10
|
+
|
|
11
|
+
export interface AnimatedSectionProps {
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
animation?: 'fade-up' | 'fade-down' | 'fade-left' | 'fade-right' | 'zoom' | 'none';
|
|
14
|
+
delay?: number;
|
|
15
|
+
duration?: number;
|
|
16
|
+
threshold?: number;
|
|
17
|
+
once?: boolean;
|
|
18
|
+
className?: string;
|
|
19
|
+
as?: React.ElementType;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Animated section wrapper with scroll-triggered animations.
|
|
24
|
+
*/
|
|
25
|
+
export function AnimatedSection({
|
|
26
|
+
children,
|
|
27
|
+
animation = 'fade-up',
|
|
28
|
+
delay = 0,
|
|
29
|
+
duration = 600,
|
|
30
|
+
threshold = 0.1,
|
|
31
|
+
once = true,
|
|
32
|
+
className = '',
|
|
33
|
+
as: Component = 'div',
|
|
34
|
+
}: AnimatedSectionProps) {
|
|
35
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
36
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
37
|
+
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
const observer = new IntersectionObserver(
|
|
40
|
+
([entry]) => {
|
|
41
|
+
if (entry.isIntersecting) {
|
|
42
|
+
setIsVisible(true);
|
|
43
|
+
if (once && ref.current) {
|
|
44
|
+
observer.unobserve(ref.current);
|
|
45
|
+
}
|
|
46
|
+
} else if (!once) {
|
|
47
|
+
setIsVisible(false);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{ threshold }
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
if (ref.current) {
|
|
54
|
+
observer.observe(ref.current);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return () => {
|
|
58
|
+
if (ref.current) {
|
|
59
|
+
observer.unobserve(ref.current);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}, [threshold, once]);
|
|
63
|
+
|
|
64
|
+
const getAnimationStyles = (): React.CSSProperties => {
|
|
65
|
+
const baseStyles: React.CSSProperties = {
|
|
66
|
+
transition: `opacity ${duration}ms ease-out, transform ${duration}ms ease-out`,
|
|
67
|
+
transitionDelay: `${delay}ms`,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
if (!isVisible) {
|
|
71
|
+
switch (animation) {
|
|
72
|
+
case 'fade-up':
|
|
73
|
+
return { ...baseStyles, opacity: 0, transform: 'translateY(30px)' };
|
|
74
|
+
case 'fade-down':
|
|
75
|
+
return { ...baseStyles, opacity: 0, transform: 'translateY(-30px)' };
|
|
76
|
+
case 'fade-left':
|
|
77
|
+
return { ...baseStyles, opacity: 0, transform: 'translateX(30px)' };
|
|
78
|
+
case 'fade-right':
|
|
79
|
+
return { ...baseStyles, opacity: 0, transform: 'translateX(-30px)' };
|
|
80
|
+
case 'zoom':
|
|
81
|
+
return { ...baseStyles, opacity: 0, transform: 'scale(0.95)' };
|
|
82
|
+
case 'none':
|
|
83
|
+
return {};
|
|
84
|
+
default:
|
|
85
|
+
return { ...baseStyles, opacity: 0, transform: 'translateY(30px)' };
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return { ...baseStyles, opacity: 1, transform: 'translateY(0) translateX(0) scale(1)' };
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
if (animation === 'none') {
|
|
93
|
+
return <Component className={className}>{children}</Component>;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<Component ref={ref} style={getAnimationStyles()} className={className}>
|
|
98
|
+
{children}
|
|
99
|
+
</Component>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Stagger animation container - animates children with increasing delays.
|
|
105
|
+
*/
|
|
106
|
+
export interface StaggerContainerProps {
|
|
107
|
+
children: React.ReactNode;
|
|
108
|
+
staggerDelay?: number;
|
|
109
|
+
animation?: AnimatedSectionProps['animation'];
|
|
110
|
+
duration?: number;
|
|
111
|
+
className?: string;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function StaggerContainer({
|
|
115
|
+
children,
|
|
116
|
+
staggerDelay = 100,
|
|
117
|
+
animation = 'fade-up',
|
|
118
|
+
duration = 600,
|
|
119
|
+
className = '',
|
|
120
|
+
}: StaggerContainerProps) {
|
|
121
|
+
return (
|
|
122
|
+
<div className={className}>
|
|
123
|
+
{React.Children.map(children, (child, index) => (
|
|
124
|
+
<AnimatedSection
|
|
125
|
+
animation={animation}
|
|
126
|
+
delay={index * staggerDelay}
|
|
127
|
+
duration={duration}
|
|
128
|
+
>
|
|
129
|
+
{child}
|
|
130
|
+
</AnimatedSection>
|
|
131
|
+
))}
|
|
132
|
+
</div>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export default AnimatedSection;
|