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:
50
packages/react/src/components/DTBadgeOverlay.tsx
Normal file
50
packages/react/src/components/DTBadgeOverlay.tsx
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* DTBadgeOverlay — Absolute-positioned badge container.
|
||||
*
|
||||
* CSS reference: bevels.css .dt-badge-bottom-right, .dt-badge-top-right, etc.
|
||||
*/
|
||||
|
||||
import type { ReactNode, CSSProperties } from 'react';
|
||||
import { cx } from '../utils/cx';
|
||||
|
||||
type BadgePosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
||||
|
||||
interface DTBadgeOverlayProps {
|
||||
children: ReactNode;
|
||||
/** Badge position @default 'bottom-right' */
|
||||
position?: BadgePosition;
|
||||
/** Offset from corner in px */
|
||||
offset?: number;
|
||||
className?: string;
|
||||
style?: CSSProperties;
|
||||
}
|
||||
|
||||
const positionClassMap: Record<BadgePosition, string> = {
|
||||
'top-left': 'dt-badge-top-left',
|
||||
'top-right': 'dt-badge-top-right',
|
||||
'bottom-left': 'dt-badge-overlay',
|
||||
'bottom-right': 'dt-badge-bottom-right',
|
||||
};
|
||||
|
||||
export function DTBadgeOverlay({
|
||||
children,
|
||||
position = 'bottom-right',
|
||||
offset,
|
||||
className,
|
||||
style,
|
||||
}: DTBadgeOverlayProps) {
|
||||
const offsetStyle: CSSProperties = offset
|
||||
? {
|
||||
...(position.includes('top') ? { top: `${offset}px` } : { bottom: `${offset}px` }),
|
||||
...(position.includes('left') ? { left: `${offset}px` } : { right: `${offset}px` }),
|
||||
}
|
||||
: {};
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cx(positionClassMap[position], className)}
|
||||
style={{ ...offsetStyle, ...style }}>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user