|
5 | 5 | </script> |
6 | 6 |
|
7 | 7 | <script lang="ts"> |
| 8 | + import { gsap } from "gsap"; |
8 | 9 | import Logo from "$/components/logo.svelte"; |
9 | 10 | import { site } from "$/site"; |
10 | 11 | import { ChartLine, Users, Shield, Download } from "$lib/assets/icons"; |
11 | 12 | import { LANDING_NAV_ITEMS, handleLandingNavClick } from "."; |
12 | 13 |
|
13 | 14 | let { user }: LandingFooterProps = $props(); |
| 15 | +
|
| 16 | + // ─── Canvas grid drawing ─────────────────────────────────────────────────── |
| 17 | + function initCanvas(canvas: HTMLCanvasElement) { |
| 18 | + const ctx = canvas.getContext("2d")!; |
| 19 | + let animId: number; |
| 20 | + let t = 0; |
| 21 | +
|
| 22 | + function resize() { |
| 23 | + canvas.width = canvas.offsetWidth; |
| 24 | + canvas.height = canvas.offsetHeight; |
| 25 | + } |
| 26 | +
|
| 27 | + function drawGrid() { |
| 28 | + const { width, height } = canvas; |
| 29 | + ctx.clearRect(0, 0, width, height); |
| 30 | +
|
| 31 | + const cols = 24; |
| 32 | + const rows = 10; |
| 33 | + const cellW = width / cols; |
| 34 | + const cellH = height / rows; |
| 35 | +
|
| 36 | + for (let r = 0; r <= rows; r++) { |
| 37 | + for (let c = 0; c <= cols; c++) { |
| 38 | + const x = c * cellW; |
| 39 | + const y = r * cellH; |
| 40 | +
|
| 41 | + const wave = Math.sin(t * 0.04 + c * 0.4 + r * 0.6) * 0.5 + 0.5; |
| 42 | + const alpha = wave * 0.35 + 0.05; |
| 43 | +
|
| 44 | + ctx.beginPath(); |
| 45 | + ctx.arc(x, y, 1.2, 0, Math.PI * 2); |
| 46 | + ctx.fillStyle = `rgba(56, 189, 248, ${alpha})`; |
| 47 | + ctx.fill(); |
| 48 | +
|
| 49 | + if (c < cols) { |
| 50 | + const lineAlpha = wave * 0.12 + 0.03; |
| 51 | + ctx.beginPath(); |
| 52 | + ctx.moveTo(x, y); |
| 53 | + ctx.lineTo(x + cellW, y); |
| 54 | + ctx.strokeStyle = `rgba(56, 189, 248, ${lineAlpha})`; |
| 55 | + ctx.lineWidth = 0.5; |
| 56 | + ctx.stroke(); |
| 57 | + } |
| 58 | +
|
| 59 | + if (r < rows) { |
| 60 | + const lineAlpha = wave * 0.12 + 0.03; |
| 61 | + ctx.beginPath(); |
| 62 | + ctx.moveTo(x, y); |
| 63 | + ctx.lineTo(x, y + cellH); |
| 64 | + ctx.strokeStyle = `rgba(56, 189, 248, ${lineAlpha})`; |
| 65 | + ctx.lineWidth = 0.5; |
| 66 | + ctx.stroke(); |
| 67 | + } |
| 68 | + } |
| 69 | + } |
| 70 | +
|
| 71 | + if (Math.random() < 0.04) { |
| 72 | + const sx = Math.floor(Math.random() * (cols + 1)) * cellW; |
| 73 | + const sy = Math.floor(Math.random() * (rows + 1)) * cellH; |
| 74 | + const sparkAlpha = 0.6 + Math.random() * 0.4; |
| 75 | + ctx.beginPath(); |
| 76 | + ctx.arc(sx, sy, 2.5 + Math.random() * 2, 0, Math.PI * 2); |
| 77 | + ctx.fillStyle = `rgba(186, 230, 253, ${sparkAlpha})`; |
| 78 | + ctx.shadowBlur = 8; |
| 79 | + ctx.shadowColor = "rgba(56, 189, 248, 0.8)"; |
| 80 | + ctx.fill(); |
| 81 | + ctx.shadowBlur = 0; |
| 82 | + } |
| 83 | +
|
| 84 | + t++; |
| 85 | + animId = requestAnimationFrame(drawGrid); |
| 86 | + } |
| 87 | +
|
| 88 | + const ro = new ResizeObserver(() => resize()); |
| 89 | + ro.observe(canvas); |
| 90 | + resize(); |
| 91 | + drawGrid(); |
| 92 | +
|
| 93 | + return () => { |
| 94 | + cancelAnimationFrame(animId); |
| 95 | + ro.disconnect(); |
| 96 | + }; |
| 97 | + } |
| 98 | +
|
| 99 | + // ─── GSAP entrance animations ───────────────────────────────────────────── |
| 100 | + function initAnimations(footer: HTMLElement) { |
| 101 | + gsap.fromTo( |
| 102 | + footer.querySelectorAll(".footer-col"), |
| 103 | + { opacity: 0, y: 24 }, |
| 104 | + { opacity: 1, y: 0, duration: 0.6, stagger: 0.1, ease: "power3.out", delay: 0.1 } |
| 105 | + ); |
| 106 | +
|
| 107 | + gsap.fromTo( |
| 108 | + footer.querySelectorAll(".footer-bottom > *"), |
| 109 | + { opacity: 0, y: 12 }, |
| 110 | + { opacity: 1, y: 0, duration: 0.5, stagger: 0.08, ease: "power2.out", delay: 0.5 } |
| 111 | + ); |
| 112 | + } |
| 113 | +
|
| 114 | + // ─── attach action ───────────────────────────────────────────────────────── |
| 115 | + function footerAttach(footer: HTMLElement) { |
| 116 | + const canvas = footer.querySelector<HTMLCanvasElement>("canvas.grid-canvas")!; |
| 117 | + const cleanupCanvas = initCanvas(canvas); |
| 118 | + initAnimations(footer); |
| 119 | + return { destroy: cleanupCanvas }; |
| 120 | + } |
14 | 121 | </script> |
15 | 122 |
|
16 | | -<footer class="relative z-10 border-t border-border/50 bg-muted/30 py-16"> |
17 | | - <div class="container mx-auto px-4"> |
| 123 | +<footer use:footerAttach class="relative z-10 overflow-hidden border-t border-border bg-background"> |
| 124 | + <!-- Electric grid canvas background --> |
| 125 | + <canvas class="grid-canvas pointer-events-none absolute inset-0 h-full w-full" aria-hidden="true" |
| 126 | + ></canvas> |
| 127 | + |
| 128 | + <div class="relative z-10 container mx-auto px-4 py-16"> |
18 | 129 | <div class="grid gap-12 md:grid-cols-2 lg:grid-cols-4"> |
19 | 130 | <!-- Brand Column --> |
20 | | - <div class="space-y-4"> |
| 131 | + <div class="footer-col space-y-4"> |
21 | 132 | <Logo variant="ghost" class="px-0 md:pl-0!" viewTransitionName="logo-footer" /> |
22 | | - <p class="text-sm text-muted-foreground"> |
| 133 | + <p class="text-sm leading-relaxed text-muted-foreground"> |
23 | 134 | {site.description} |
24 | 135 | </p> |
25 | | - <p class="text-sm text-muted-foreground"> |
| 136 | + <p class="text-sm leading-relaxed text-muted-foreground"> |
26 | 137 | Software-focused tracking and billing for practical expense allocation. |
27 | 138 | </p> |
28 | 139 | </div> |
29 | 140 |
|
30 | 141 | <!-- Navigation Links --> |
31 | | - <div class="space-y-4"> |
32 | | - <h3 class="text-sm font-semibold tracking-wider text-foreground uppercase">Navigation</h3> |
| 142 | + <div class="footer-col space-y-4"> |
| 143 | + <h3 class="text-sm font-semibold">Navigation</h3> |
33 | 144 | <ul class="space-y-3"> |
34 | 145 | {#each LANDING_NAV_ITEMS as item} |
35 | 146 | <li> |
36 | 147 | <a |
37 | 148 | href={item.href} |
38 | 149 | onclick={(e) => handleLandingNavClick(e, item.href)} |
39 | | - class="text-sm text-muted-foreground transition-colors hover:text-primary" |
| 150 | + class="text-sm text-muted-foreground transition-colors hover:text-foreground" |
40 | 151 | > |
41 | 152 | {item.label} |
42 | 153 | </a> |
|
45 | 156 | </ul> |
46 | 157 | </div> |
47 | 158 |
|
48 | | - <!-- Features Highlight --> |
49 | | - <div class="space-y-4"> |
50 | | - <h3 class="text-sm font-semibold tracking-wider text-foreground uppercase">Features</h3> |
| 159 | + <!-- Features --> |
| 160 | + <div class="footer-col space-y-4"> |
| 161 | + <h3 class="text-sm font-semibold">Features</h3> |
51 | 162 | <ul class="space-y-3"> |
52 | 163 | <li class="flex items-center gap-2 text-sm text-muted-foreground"> |
53 | | - <ChartLine class="h-4 w-4 text-primary" /> |
| 164 | + <ChartLine class="h-4 w-4 shrink-0" /> |
54 | 165 | <span>Billing Summaries</span> |
55 | 166 | </li> |
56 | 167 | <li class="flex items-center gap-2 text-sm text-muted-foreground"> |
57 | | - <Users class="h-4 w-4 text-primary" /> |
| 168 | + <Users class="h-4 w-4 shrink-0" /> |
58 | 169 | <span>User Accounts</span> |
59 | 170 | </li> |
60 | 171 | <li class="flex items-center gap-2 text-sm text-muted-foreground"> |
61 | | - <Shield class="h-4 w-4 text-primary" /> |
| 172 | + <Shield class="h-4 w-4 shrink-0" /> |
62 | 173 | <span>Input Validation</span> |
63 | 174 | </li> |
64 | 175 | <li class="flex items-center gap-2 text-sm text-muted-foreground"> |
65 | | - <Download class="h-4 w-4 text-primary" /> |
66 | | - <span>Import & Export</span> |
| 176 | + <Download class="h-4 w-4 shrink-0" /> |
| 177 | + <span>Import & Export</span> |
67 | 178 | </li> |
68 | 179 | </ul> |
69 | 180 | </div> |
70 | 181 |
|
71 | 182 | <!-- Use Cases --> |
72 | | - <div class="space-y-4"> |
73 | | - <h3 class="text-sm font-semibold tracking-wider text-foreground uppercase">Built For</h3> |
| 183 | + <div class="footer-col space-y-4"> |
| 184 | + <h3 class="text-sm font-semibold">Built For</h3> |
74 | 185 | <ul class="space-y-3"> |
75 | | - <li class="text-sm text-muted-foreground">Multi-Tenant Buildings</li> |
76 | | - <li class="text-sm text-muted-foreground">Homeowners with Rentals</li> |
77 | | - <li class="text-sm text-muted-foreground">Property Managers</li> |
| 186 | + {#each ["Multi-Tenant Buildings", "Homeowners with Rentals", "Property Managers"] as item} |
| 187 | + <li class="text-sm text-muted-foreground">{item}</li> |
| 188 | + {/each} |
78 | 189 | </ul> |
79 | 190 | </div> |
80 | 191 | </div> |
81 | 192 |
|
82 | | - <!-- Divider --> |
83 | | - <div class="my-10 h-px bg-border/50"></div> |
| 193 | + <div class="my-10 border-t border-border"></div> |
84 | 194 |
|
85 | 195 | <!-- Bottom Row --> |
86 | | - <div class="flex flex-col items-center justify-between gap-4 md:flex-row"> |
87 | | - <p class="text-sm text-muted-foreground"> |
| 196 | + <div class="footer-bottom flex flex-col items-center justify-between gap-4 md:flex-row"> |
| 197 | + <p class="text-xs text-muted-foreground"> |
88 | 198 | © {new Date().getFullYear()} |
89 | | - {site.name}. All rights reserved. |
| 199 | + <span class="font-medium text-foreground">{site.name}</span>. All rights reserved. |
90 | 200 | </p> |
| 201 | + |
91 | 202 | <div class="flex items-center gap-6"> |
92 | 203 | {#if user} |
93 | 204 | <a |
94 | 205 | data-sveltekit-reload |
95 | 206 | href="/dashboard" |
96 | | - class="text-sm text-muted-foreground transition-colors hover:text-primary" |
| 207 | + class="text-xs text-muted-foreground transition-colors hover:text-foreground" |
97 | 208 | > |
98 | | - Go to Dashboard |
| 209 | + Dashboard |
99 | 210 | </a> |
100 | 211 | {:else} |
101 | 212 | <a |
102 | 213 | data-sveltekit-reload |
103 | 214 | href="/auth?act=login" |
104 | | - class="text-sm text-muted-foreground transition-colors hover:text-primary" |
| 215 | + class="text-xs text-muted-foreground transition-colors hover:text-foreground" |
105 | 216 | > |
106 | 217 | Sign In |
107 | 218 | </a> |
108 | 219 | <a |
109 | 220 | data-sveltekit-reload |
110 | 221 | href="/auth?act=register" |
111 | | - class="text-sm text-muted-foreground transition-colors hover:text-primary" |
| 222 | + class="text-xs text-muted-foreground transition-colors hover:text-foreground" |
112 | 223 | > |
113 | 224 | Get Started |
114 | 225 | </a> |
|
117 | 228 | </div> |
118 | 229 | </div> |
119 | 230 | </footer> |
| 231 | + |
| 232 | +<style> |
| 233 | + /* GSAP animates these in — start hidden */ |
| 234 | + .footer-col, |
| 235 | + .footer-bottom > * { |
| 236 | + opacity: 0; |
| 237 | + } |
| 238 | +</style> |
0 commit comments