diabled button when no text on input box #79
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue Title: Disable Add button when input is empty (#77)
Description:
This update addresses the enhancement request to disable the "Add" button when the input field is empty, preventing users from submitting empty todo items. In addition, when the button is disabled, the pointer style will change to indicate the disabled state by showing a red cursor instead of the default pointer cursor.
Changes Implemented:
Button Disabled State:
The "Add" button is now conditionally disabled if the input field is empty or contains only whitespace.
This is achieved by checking the todo state using todo.trim() === ''. If true, the button is disabled.
Custom Styling for Disabled Button:
The disabled button's appearance has been updated to reflect its inactive state.
The cursor changes to a custom red pointer when hovering over the disabled button.
The button's default cursor: pointer behavior is removed when disabled.
CSS for Disabled State:
Added custom CSS rules to style the disabled button:
Changed the cursor to not-allowed and set it to red for better visual feedback.
Additional styles were added to make the button appear visually distinct when disabled (such as reduced opacity or gray text).
Files Modified:
in TODO-LIST folder /
src/Home.jsx: Updated to conditionally disable the submit button based on input value.
app.css: (or relevant stylesheet): Added styles to modify the cursor and appearance of the disabled button.