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

Edit todo items #126

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

drunkensponge
Copy link

@drunkensponge drunkensponge commented Sep 14, 2023

What this does

You can edit titles of todo items, no matter in which state they are (open, paused, completed).

Option 1: Use edit button to enable edit mode of selected item
Option 2: Double click on item title to enable endit mode of selected item

Changes to the title are submitted whenever the textbox loses focus or you hit enter.

Before:
image

After:
image

What this does (according to GitHub Copilot)

🤖 Generated by Copilot at 06f50c1

This pull request adds the ability to edit the text of an existing todo item in the todometer app. It updates the Item.jsx component, the appStateReducer function, and the Item.module.css file to implement the editing feature. It also uses React hooks and conditional rendering to handle the user interaction.

🤖 Generated by Copilot at 06f50c1

  • Use useState and useRef hooks in Item.jsx to manage editing mode and input value (link)
  • Render a form with an input element or a div with the item text based on editing mode (link)
  • Add an edit button to the buttons row that toggles editing mode and dispatches UPDATE_ITEM action with edited value (link)
  • Handle form submission and input blur events to update the item and exit editing mode (link)
  • Modify appStateReducer in AppContext.jsx to update the text property of the item along with the status property (link)
  • Add CSS styles for the edit button, the form, and the input element in Item.module.css (link)

Relevant issue

Closes #83

A poem

🤖 Generated by Copilot at 06f50c1

If you want to edit an item's text
You can double-click on it, and next
The Item.jsx will show
An input and a button below
And the appStateReducer will handle the rest

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.

Feature Request: Edit cards after creation
1 participant