logos-kit 1.0.0
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/GoogleAnalytics.tsx +31 -0
- package/ScrollReveal.tsx +41 -0
- package/analytics.ts +27 -0
- package/animations.css +43 -0
- package/package.json +26 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import Script from "next/script";
|
|
4
|
+
import type { ReactElement } from "react";
|
|
5
|
+
|
|
6
|
+
type Props = {
|
|
7
|
+
measurementId: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default function GoogleAnalytics({
|
|
11
|
+
measurementId,
|
|
12
|
+
}: Props): ReactElement | null {
|
|
13
|
+
if (!measurementId) return null;
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<>
|
|
17
|
+
<Script
|
|
18
|
+
src={`https://www.googletagmanager.com/gtag/js?id=${measurementId}`}
|
|
19
|
+
strategy="afterInteractive"
|
|
20
|
+
/>
|
|
21
|
+
<Script id="ga-init" strategy="afterInteractive">
|
|
22
|
+
{`
|
|
23
|
+
window.dataLayer = window.dataLayer || [];
|
|
24
|
+
function gtag(){dataLayer.push(arguments);}
|
|
25
|
+
gtag('js', new Date());
|
|
26
|
+
gtag('config', '${measurementId}');
|
|
27
|
+
`}
|
|
28
|
+
</Script>
|
|
29
|
+
</>
|
|
30
|
+
);
|
|
31
|
+
}
|
package/ScrollReveal.tsx
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef } from "react";
|
|
4
|
+
import type { ReactElement, ReactNode } from "react";
|
|
5
|
+
|
|
6
|
+
type Props = {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
threshold?: number;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default function ScrollReveal({
|
|
13
|
+
children,
|
|
14
|
+
className,
|
|
15
|
+
threshold = 0.12,
|
|
16
|
+
}: Props): ReactElement {
|
|
17
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
const el = ref.current;
|
|
21
|
+
if (!el) return;
|
|
22
|
+
const observer = new IntersectionObserver(
|
|
23
|
+
([entry]) => {
|
|
24
|
+
if (entry?.isIntersecting) {
|
|
25
|
+
el.classList.add("is-visible");
|
|
26
|
+
observer.disconnect();
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{ threshold },
|
|
30
|
+
);
|
|
31
|
+
observer.observe(el);
|
|
32
|
+
return () => observer.disconnect();
|
|
33
|
+
}, [threshold]);
|
|
34
|
+
|
|
35
|
+
const cls = className ? `reveal-group ${className}` : "reveal-group";
|
|
36
|
+
return (
|
|
37
|
+
<div ref={ref} className={cls}>
|
|
38
|
+
{children}
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
41
|
+
}
|
package/analytics.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface Window {
|
|
3
|
+
gtag?: (...args: unknown[]) => void;
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function trackEvent(
|
|
8
|
+
name: string,
|
|
9
|
+
params?: Record<string, string | number | boolean>,
|
|
10
|
+
): void {
|
|
11
|
+
if (typeof window === "undefined" || typeof window.gtag !== "function") return;
|
|
12
|
+
window.gtag("event", name, params);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const track = {
|
|
16
|
+
contactFormSubmit: () => trackEvent("contact_form_submit"),
|
|
17
|
+
whatsappClick: (context?: string) =>
|
|
18
|
+
trackEvent("whatsapp_click", context ? { context } : undefined),
|
|
19
|
+
phoneClick: () => trackEvent("phone_click"),
|
|
20
|
+
emailClick: () => trackEvent("email_click"),
|
|
21
|
+
ctaClick: (label: string) => trackEvent("cta_click", { label }),
|
|
22
|
+
socialClick: (platform: string) => trackEvent("social_click", { platform }),
|
|
23
|
+
custom: (
|
|
24
|
+
name: string,
|
|
25
|
+
params?: Record<string, string | number | boolean>,
|
|
26
|
+
) => trackEvent(name, params),
|
|
27
|
+
} as const;
|
package/animations.css
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/* ── Logos Kit — Scroll & Hero animations ─────────────────────────── */
|
|
2
|
+
|
|
3
|
+
@keyframes fade-in-up {
|
|
4
|
+
from { opacity: 0; transform: translateY(20px); }
|
|
5
|
+
to { opacity: 1; transform: translateY(0); }
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/* Scroll reveal */
|
|
9
|
+
.reveal-item {
|
|
10
|
+
opacity: 0;
|
|
11
|
+
transform: translateY(20px);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.reveal-group.is-visible .reveal-item { animation: fade-in-up 0.6s ease forwards; animation-delay: 0ms; }
|
|
15
|
+
.reveal-group.is-visible [data-reveal-delay="1"].reveal-item { animation: fade-in-up 0.6s ease forwards; animation-delay: 120ms; }
|
|
16
|
+
.reveal-group.is-visible [data-reveal-delay="2"].reveal-item { animation: fade-in-up 0.6s ease forwards; animation-delay: 240ms; }
|
|
17
|
+
.reveal-group.is-visible [data-reveal-delay="3"].reveal-item { animation: fade-in-up 0.6s ease forwards; animation-delay: 360ms; }
|
|
18
|
+
.reveal-group.is-visible [data-reveal-delay="4"].reveal-item { animation: fade-in-up 0.6s ease forwards; animation-delay: 480ms; }
|
|
19
|
+
.reveal-group.is-visible [data-reveal-delay="5"].reveal-item { animation: fade-in-up 0.6s ease forwards; animation-delay: 600ms; }
|
|
20
|
+
.reveal-group.is-visible [data-reveal-delay="6"].reveal-item { animation: fade-in-up 0.6s ease forwards; animation-delay: 720ms; }
|
|
21
|
+
.reveal-group.is-visible [data-reveal-delay="7"].reveal-item { animation: fade-in-up 0.6s ease forwards; animation-delay: 840ms; }
|
|
22
|
+
.reveal-group.is-visible [data-reveal-delay="8"].reveal-item { animation: fade-in-up 0.6s ease forwards; animation-delay: 960ms; }
|
|
23
|
+
.reveal-group.is-visible [data-reveal-delay="9"].reveal-item { animation: fade-in-up 0.6s ease forwards; animation-delay: 1080ms; }
|
|
24
|
+
.reveal-group.is-visible [data-reveal-delay="10"].reveal-item { animation: fade-in-up 0.6s ease forwards; animation-delay: 1200ms; }
|
|
25
|
+
|
|
26
|
+
/* Hero reveal */
|
|
27
|
+
.hero-item {
|
|
28
|
+
opacity: 0;
|
|
29
|
+
transform: translateY(20px);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.hero-active .hero-item { animation: fade-in-up 0.7s ease forwards; animation-delay: 0ms; }
|
|
33
|
+
.hero-active [data-hero-delay="1"].hero-item { animation: fade-in-up 0.7s ease forwards; animation-delay: 150ms; }
|
|
34
|
+
.hero-active [data-hero-delay="2"].hero-item { animation: fade-in-up 0.7s ease forwards; animation-delay: 300ms; }
|
|
35
|
+
.hero-active [data-hero-delay="3"].hero-item { animation: fade-in-up 0.7s ease forwards; animation-delay: 450ms; }
|
|
36
|
+
.hero-active [data-hero-delay="4"].hero-item { animation: fade-in-up 0.7s ease forwards; animation-delay: 600ms; }
|
|
37
|
+
.hero-active [data-hero-delay="5"].hero-item { animation: fade-in-up 0.7s ease forwards; animation-delay: 750ms; }
|
|
38
|
+
|
|
39
|
+
/* Accessibility */
|
|
40
|
+
@media (prefers-reduced-motion: reduce) {
|
|
41
|
+
.hero-item,
|
|
42
|
+
.reveal-item { opacity: 1; transform: none; animation: none; }
|
|
43
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "logos-kit",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Shared components and styles for Logos Web Studio sites",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/lumen-web-studio/logos-kit.git"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"ScrollReveal.tsx",
|
|
12
|
+
"animations.css",
|
|
13
|
+
"GoogleAnalytics.tsx",
|
|
14
|
+
"analytics.ts"
|
|
15
|
+
],
|
|
16
|
+
"exports": {
|
|
17
|
+
"./ScrollReveal": "./ScrollReveal.tsx",
|
|
18
|
+
"./animations.css": "./animations.css",
|
|
19
|
+
"./GoogleAnalytics": "./GoogleAnalytics.tsx",
|
|
20
|
+
"./analytics": "./analytics.ts"
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"react": ">=18",
|
|
24
|
+
"next": ">=14"
|
|
25
|
+
}
|
|
26
|
+
}
|