react-chessboard
react-chessboard copied to clipboard
The React Chessboard Library used at ChessOpenings.co.uk. Inspired and adapted from the unmaintained Chessboard.jsx.
Had a hell of a time trying to figure this one out. Thought I would share the solution I found here to help anyone else trying to set up automated...
The bug was, when clicked on a piece, and afterwards an empty square, the possible options for the piece was still showing. But when you clicked on a possible square,...
Right now react-chessboard uses duration-based animations (https://github.com/Clariity/react-chessboard/blob/90899f3aeb8650722615ca67b057eab73dd6fe6d/package/src/components/Piece.js#L102) - these are good because they're simple and predictable. However, there is a big downside: further pieces move really fast, and closer pieces...
Amended behaviour of onPromotionPieceSelect prop. - onPromotionPieceSelect is now passed 'promoteFromSquare' and 'promoteToSquare' arguments. - onPromotionPieceSelect is now a required prop with default value: () => true - onPromotionPieceSelect return...
I have the following code (simplified to remove unrelated stuff): ```typescript import { Box, Flex } from "@chakra-ui/react"; import { ReactNode, useEffect, useMemo, useRef, useState } from "react"; import {...
I have a custom isDraggablePiece function, which relies on data I get from the server. And it is wrapped with useCallback. I see that package uses multiple version of that...
DEMO: https://github.com/Clariity/react-chessboard/assets/42891870/530636cf-3ea1-4244-9454-51885ac3f372 Things TO DO: - [ ] Discuss and agree new archtecture, components and props - [ ] Actualize documentation
How can I show dead pieces outside the board during the game?
Made arrows draw in an "L" shape if a valid knight move. This looks cleaner and follows the standard practice now seen on most chess sites.
On tablet, the onDragOverSquare function wasn't being called. I added in an onTouchMove event on the square Div which now calls the onDragOverSquare if the square is different, This maintains...