Add storefront component migration: cards, badges, progress bars, animations, and React wrapper package
Major feature migration from dt-shopify-storefront into the design system: - Card system: per-card color modes (normal/emphasis/warning/success/other), progress bars, full-bleed card body (card-body-flush), image bevel clip-paths, and visible structural borders at bevel corners - Badge system: dt-card-badge with position-aware offsets for cards vs media frames - Media frames: dt-bevel-media with inner surface fill, image clipping, and "MISSING MEDIA" placeholder for empty containers - Interactive bevel buttons: dt-btn with hover/selected states and pulse animation - Menu items: dt-menu-item with active states and level indentation - Animations: scale-in, fade-in, slide-up, pulse, ping, spin keyframes - Feature legend: CSS grid for product feature icons with state colors - Scrollbar styling for DT brand - New @dangerousthings/react package wrapping web CSS components - New @dangerousthings/tailwind-preset package - New @dangerousthings/hex-background package - Desktop showcase rewritten in React with Tailwind CSS - Mobile showcase updated with new screens (animations, filters, advanced cards) - Tokens: added mode color tokens, RGB variants, and selected-state tokens Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
14
packages/react/src/hooks/useDTWebTheme.ts
Normal file
14
packages/react/src/hooks/useDTWebTheme.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Hook to access the DTWebThemeProvider context.
|
||||
*/
|
||||
import { useContext } from 'react';
|
||||
import { DTWebThemeContext } from '../components/DTWebThemeProvider';
|
||||
import type { ThemeBrand, ThemeMode } from '@dangerousthings/tokens';
|
||||
|
||||
export function useDTWebTheme(): { brand: ThemeBrand; theme: ThemeMode } {
|
||||
const ctx = useContext(DTWebThemeContext);
|
||||
if (!ctx) {
|
||||
return { brand: 'dt', theme: 'dark' };
|
||||
}
|
||||
return ctx;
|
||||
}
|
||||
24
packages/react/src/hooks/usePulse.ts
Normal file
24
packages/react/src/hooks/usePulse.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Hook: toggles dt-animate-pulse CSS class based on enabled flag.
|
||||
*/
|
||||
import { useEffect } from 'react';
|
||||
|
||||
export function usePulse(
|
||||
ref: React.RefObject<HTMLElement | null>,
|
||||
enabled = false,
|
||||
): void {
|
||||
useEffect(() => {
|
||||
const el = ref.current;
|
||||
if (!el) return;
|
||||
|
||||
if (enabled) {
|
||||
el.classList.add('dt-animate-pulse');
|
||||
} else {
|
||||
el.classList.remove('dt-animate-pulse');
|
||||
}
|
||||
|
||||
return () => {
|
||||
el.classList.remove('dt-animate-pulse');
|
||||
};
|
||||
}, [ref, enabled]);
|
||||
}
|
||||
29
packages/react/src/hooks/useScaleIn.ts
Normal file
29
packages/react/src/hooks/useScaleIn.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Hook: applies dt-animate-scale-in CSS class on mount.
|
||||
*/
|
||||
import { useEffect } from 'react';
|
||||
|
||||
export function useScaleIn(
|
||||
ref: React.RefObject<HTMLElement | null>,
|
||||
options?: { duration?: number; delay?: number },
|
||||
): void {
|
||||
useEffect(() => {
|
||||
const el = ref.current;
|
||||
if (!el) return;
|
||||
|
||||
if (options?.duration) {
|
||||
el.style.animationDuration = `${options.duration}ms`;
|
||||
}
|
||||
if (options?.delay) {
|
||||
el.style.animationDelay = `${options.delay}ms`;
|
||||
}
|
||||
|
||||
el.classList.add('dt-animate-scale-in');
|
||||
|
||||
return () => {
|
||||
el.classList.remove('dt-animate-scale-in');
|
||||
el.style.animationDuration = '';
|
||||
el.style.animationDelay = '';
|
||||
};
|
||||
}, [ref, options?.duration, options?.delay]);
|
||||
}
|
||||
Reference in New Issue
Block a user