Summary
Currently, over 100+ tools in the repository implement their own "Copy to Clipboard" logic. This creates code duplication and UI inconsistency. We need a single, reusable CopyButton component to standardize this behavior.
Requirements
Props:
text: The string to be copied.
variant: icon (default) or text (for labeled buttons).
className: For custom positioning.
Behavior:
Uses navigator.clipboard.writeText.
Displays a "Copied!" toast using the existing react-toastify configuration.
Temporarily changes the icon to a "Check" mark for visual feedback.
Scope: Once built, replace the custom copy logic in a few sample tools (e.g., wordCounterComponent, jsonToTxt) to demonstrate usage.
Technical Implementation Details
File Path: app/components/theme/ui/CopyButton.tsx
Dependencies: Phosphor Icons (already in
package.json
).
Summary
Currently, over 100+ tools in the repository implement their own "Copy to Clipboard" logic. This creates code duplication and UI inconsistency. We need a single, reusable CopyButton component to standardize this behavior.
Requirements
Props:
text: The string to be copied.
variant: icon (default) or text (for labeled buttons).
className: For custom positioning.
Behavior:
Uses navigator.clipboard.writeText.
Displays a "Copied!" toast using the existing react-toastify configuration.
Temporarily changes the icon to a "Check" mark for visual feedback.
Scope: Once built, replace the custom copy logic in a few sample tools (e.g., wordCounterComponent, jsonToTxt) to demonstrate usage.
Technical Implementation Details
File Path: app/components/theme/ui/CopyButton.tsx
Dependencies: Phosphor Icons (already in
package.json
).