Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

diabled button when no text on input box #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lakshya-26
Copy link

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.
github todo
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant