chore(repo): sync wireframe structure and references
This commit is contained in:
1 parent
05d2d5777f
commit
d953a79e95
453 files changed
+36639
-621
No files matched your search
@@ -0,0 +1,102 @@
|
||||
"use client";
|
||||
|
||||
import { useRef, useState, useEffect, useCallback } from "react";
|
||||
|
||||
/* ──────────────────────────────────────────────────────────────────────────
|
||||
* CanvasHint — the small centred onboarding popup shared by the interactive
|
||||
* product demos (workflow editor, kanban, approval inbox, email builder). It
|
||||
* shows a looping "drag" micro-animation, a title and a one-line subtitle, and
|
||||
* a close button. Designed to sit inside a `position: relative` dotted-grid
|
||||
* canvas container.
|
||||
*
|
||||
* useCanvasHint() drives it: the hint appears once its container scrolls into
|
||||
* view and is dismissed on the first real interaction (or via the X).
|
||||
* ────────────────────────────────────────────────────────────────────────── */
|
||||
|
||||
const HINT_CSS = `
|
||||
@keyframes hint-popup-in{from{opacity:0;transform:scale(0.95)}to{opacity:1;transform:scale(1)}}
|
||||
@keyframes hint-mini-drag{0%,100%{transform:translate(0,0)}20%{transform:translate(0,-4px)}40%{transform:translate(34px,-4px)}60%{transform:translate(34px,0)}80%{transform:translate(0,0)}}
|
||||
@keyframes hint-mini-cursor{0%,15%{transform:translate(38px,24px)}20%{transform:translate(22px,16px)}40%,60%{transform:translate(58px,16px)}65%{transform:translate(60px,24px)}80%,100%{transform:translate(38px,24px)}}
|
||||
.hint-mini-drag{animation:hint-mini-drag 3s ease-in-out infinite}
|
||||
.hint-mini-cursor{animation:hint-mini-cursor 3s ease-in-out infinite}
|
||||
@media (prefers-reduced-motion:reduce){.hint-mini-drag,.hint-mini-cursor{animation:none}}
|
||||
`;
|
||||
|
||||
export function useCanvasHint<T extends HTMLElement>() {
|
||||
const ref = useRef<T | null>(null);
|
||||
const [show, setShow] = useState(false);
|
||||
const dismissed = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
const el = ref.current;
|
||||
if (!el || dismissed.current) return;
|
||||
const obs = new IntersectionObserver(
|
||||
(entries) => entries.forEach((e) => { if (e.isIntersecting && !dismissed.current) setShow(true); }),
|
||||
{ threshold: 0.4 }
|
||||
);
|
||||
obs.observe(el);
|
||||
return () => obs.disconnect();
|
||||
}, []);
|
||||
|
||||
const dismiss = useCallback(() => {
|
||||
dismissed.current = true;
|
||||
setShow(false);
|
||||
}, []);
|
||||
|
||||
return { ref, show, dismiss };
|
||||
}
|
||||
|
||||
export default function CanvasHint({
|
||||
show,
|
||||
onDismiss,
|
||||
title,
|
||||
subtitle,
|
||||
}: {
|
||||
show: boolean;
|
||||
onDismiss: () => void;
|
||||
title: string;
|
||||
subtitle: string;
|
||||
}) {
|
||||
if (!show) return null;
|
||||
// z-[45] sits above canvas content (EmailBuilder reset btn z-40) but below the
|
||||
// navbar (header z-50 / its dropdown), so the hint never floats over the
|
||||
// expanded nav.
|
||||
return (
|
||||
<div data-canvas-hint className="absolute inset-0 z-[45] flex items-center justify-center" style={{ pointerEvents: "none" }}>
|
||||
<style dangerouslySetInnerHTML={{ __html: HINT_CSS }} />
|
||||
<div
|
||||
className="relative flex flex-col items-center gap-3 rounded-2xl px-8 py-6"
|
||||
style={{
|
||||
background: "rgba(255,255,255,0.97)",
|
||||
border: "1px solid var(--border-light)",
|
||||
boxShadow: "0 12px 40px rgba(0,0,0,0.12)",
|
||||
animation: "hint-popup-in 0.3s ease both",
|
||||
pointerEvents: "auto",
|
||||
}}
|
||||
>
|
||||
<button
|
||||
onClick={onDismiss}
|
||||
aria-label="Hinweis schließen"
|
||||
className="absolute top-2.5 right-2.5 w-6 h-6 rounded-md flex items-center justify-center hover:bg-[var(--bg-muted)] transition-colors"
|
||||
style={{ color: "var(--text-muted)" }}
|
||||
>
|
||||
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round">
|
||||
<path d="M2 2l8 8M10 2l-8 8" />
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
{/* Mini drag micro-animation */}
|
||||
<div className="relative" style={{ width: 90, height: 50 }}>
|
||||
<div className="hint-mini-drag" style={{ width: 36, height: 24, borderRadius: 6, border: "2px solid #B0B8C4", background: "#F3F4F6", position: "absolute", top: 8, left: 6 }} />
|
||||
<div style={{ width: 36, height: 24, borderRadius: 6, border: "2px solid var(--accent-yellow)", background: "var(--accent-yellow-light)", position: "absolute", top: 16, left: 44, opacity: 0.5 }} />
|
||||
<svg className="hint-mini-cursor" width="16" height="16" viewBox="0 0 24 24" fill="none" style={{ position: "absolute" }}>
|
||||
<path d="M5 3l14 8-6 2-4 6z" fill="#1A1A1A" stroke="white" strokeWidth="1.5" />
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<span className="text-[15px] font-semibold" style={{ color: "var(--text-primary)" }}>{title}</span>
|
||||
<span className="text-[12px]" style={{ color: "var(--text-muted)" }}>{subtitle}</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user