daily-code
daily-code copied to clipboard
fix: Clickable Disabled Navigation Buttons in TrackTools Component
Description:
This PR addresses the issue where the "Prev" and "Next" buttons in the TrackTools component remain clickable even when disabled, resulting in unnecessary re-renders. This was happening because the Link component was still clickable even if the button inside it is disabled.
Changes Made:
-
Prev Button:
- If
problemIndexis 0, the pointer-events on the Link are disabled. - The Link is wrapped in a
divthat has acursor: not-allowedstyle ifproblemIndexis 0 (indicating the First Slide).
- If
-
Next Button:
- If
problemIndex + 1equals the length oftrack.problems, the pointer-events on the Link are also disabled. - The Link is wrapped in a
divthat applies thecursor: not-allowedstyle ifproblemIndex + 1equals the length oftrack.problems(indicating the Last Slide).
- If
Demo
https://github.com/user-attachments/assets/3cfb7cca-7cde-4d59-a55a-73aa1cf5dca6