Files
dt-design-system/packages/react-native/src/components/DTBadgeOverlay.tsx
michael e74c285b70 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>
2026-03-06 10:18:39 -08:00

46 lines
1.0 KiB
TypeScript

/**
* DT Badge Overlay
*
* Positioning wrapper for badges on cards and media frames.
* Places children absolutely at a specified corner with configurable offset.
*/
import {ReactNode} from 'react';
import {View, ViewStyle, StyleProp} from 'react-native';
type BadgePosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
interface DTBadgeOverlayProps {
children: ReactNode;
/**
* Corner position for the badge
* @default 'bottom-right'
*/
position?: BadgePosition;
/**
* Offset from the corner in pixels
* @default 8
*/
offset?: number;
/**
* Additional styles
*/
style?: StyleProp<ViewStyle>;
}
export function DTBadgeOverlay({
children,
position = 'bottom-right',
offset = 8,
style,
}: DTBadgeOverlayProps) {
const positionStyle: ViewStyle = {
position: 'absolute',
zIndex: 4,
...(position.includes('top') ? {top: offset} : {bottom: offset}),
...(position.includes('right') ? {right: offset} : {left: offset}),
};
return <View style={[positionStyle, style]}>{children}</View>;
}