redraw cards

This commit is contained in:
Gavin McDonald
2025-06-12 11:53:35 -04:00
parent 5c18b8afbf
commit e75d9b41bc
6 changed files with 79 additions and 9 deletions

View File

@@ -17,9 +17,17 @@ type CardProps = {
position: Layout;
settings: Settings;
flipAction: () => void;
redrawAction: () => void;
};
export default function Card({ dm, card, position, settings, flipAction }: CardProps) {
export default function Card({
dm,
card,
position,
settings,
flipAction,
redrawAction,
}: CardProps) {
const [tooltip, setTooltip] = useState<React.ReactNode>(null);
const { aria, flipped } = card;
@@ -71,8 +79,8 @@ export default function Card({ dm, card, position, settings, flipAction }: CardP
/>
{dm && !flipped && (
<StackTheDeck
onRedo={() => console.log('Redo')}
onPick={() => console.log('Pick')}
onRedraw={redrawAction}
onSelect={() => console.log('Pick')}
onHover={setTooltip}
/>
)}

View File

@@ -1,15 +1,15 @@
import { GalleryHorizontalEnd, RefreshCw } from 'lucide-react';
interface StackTheDeckProps {
onRedo: () => void;
onPick: () => void;
onRedraw: () => void;
onSelect: () => void;
onHover: (state: React.ReactNode) => void;
className?: string;
}
export default function StackTheDeck({
onRedo,
onPick,
onRedraw,
onSelect,
onHover,
className = '',
}: StackTheDeckProps) {
@@ -28,7 +28,7 @@ export default function StackTheDeck({
onTouchStart={() => onHover(<p className="text-yellow-400">Redraw</p>)}
onTouchEnd={() => onHover(null)}
className={`p-1 transition-all duration-250 text-yellow-400 hover:text-yellow-300 hover:drop-shadow-[0_0_3px_#ffd700] cursor-pointer`}
onClick={curryHandleClick(onRedo)}
onClick={curryHandleClick(onRedraw)}
>
<RefreshCw className="w-3 h-3" />
</button>
@@ -39,7 +39,7 @@ export default function StackTheDeck({
onTouchStart={() => onHover(<p className="text-yellow-400">Select</p>)}
onTouchEnd={() => onHover(null)}
className={`p-1 transition-all duration-250 text-yellow-400 hover:text-yellow-300 hover:drop-shadow-[0_0_3px_#ffd700] cursor-pointer`}
onClick={curryHandleClick(onPick)}
onClick={curryHandleClick(onSelect)}
>
<GalleryHorizontalEnd className="w-3 h-3" />
</button>