import { motion, useTransform } from 'motion/react'; import React from 'react'; import { useInternalContext } from './context'; import { styles } from './styles'; import type { SheetDragIndicatorProps } from './types'; import { applyStyles } from './utils'; export function SheetDragIndicator({ style, className = '', unstyled, ...rest }: SheetDragIndicatorProps) { const sheetContext = useInternalContext(); const indicator1Transform = useTransform( sheetContext.indicatorRotation, (r) => `translateX(2px) rotate(${r}deg)` ); const indicator2Transform = useTransform( sheetContext.indicatorRotation, (r) => `translateX(-2px) rotate(${-1 * r}deg)` ); const isUnstyled = unstyled ?? sheetContext.unstyled; const indicatorWrapperStyle = { ...applyStyles(styles.indicatorWrapper, isUnstyled), ...style, }; const indicatorStyle = applyStyles(styles.indicator, isUnstyled); return (
); }