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

must have 2: add a word #5

Open
9 tasks done
AlinaTaoRao opened this issue Feb 15, 2022 · 0 comments · Fixed by #15
Open
9 tasks done

must have 2: add a word #5

AlinaTaoRao opened this issue Feb 15, 2022 · 0 comments · Fixed by #15
Assignees
Milestone

Comments

@AlinaTaoRao
Copy link
Collaborator

AlinaTaoRao commented Feb 15, 2022

Add word

"As a user I want a input field and a add button so that I can input and add a word to the list."

  • Given the input contains only letters it will be added to the words list, and the list will be re-rendered.

Logic: Add word

  • type: listeners: Add listener addEventListener('click', inputWord) to form element with the id input-form in /listeners.

  • type: handlers: Write a function inputWord(event) in/handlers. It's an entry point for adding or removing a word. It is called each time the user clicks the "add word" or the "remove word" button. It gathers user input from DOM and then render new words by calling function sortStrings(data.words, data.sort) and renderList(sorted) to a div with the id listContainer. export function.

  • type: logic: Write a function sortStrings(toSort = [], sortType = 'oldest') in /logic. It will sort words depend on sort type option. export function.

  • type: logic: Write a function isWord(text = '') in /logic to check if the user input is a word. export function.

  • type: components: Write a function renderList(toRender = []) in render-list.js. Convert each word element from an array to text in each litag , and an ultag wrap around all the li. export function.

Interface: Add word

  • type html: A form tag with the id input-form.

  • type html: A input tag with name="text" placeholder="new word" as a form element.

  • type html: A input tag with type="button" value="add" as a form element.

Interaction: Add word

  • Given the input contains only letters it will be added to the words list, and the list will be re-rendered.
@AlinaTaoRao AlinaTaoRao added this to the dev milestone Feb 15, 2022
@AlinaTaoRao AlinaTaoRao self-assigned this Feb 15, 2022
@AlinaTaoRao AlinaTaoRao linked a pull request Feb 17, 2022 that will close this issue
56 tasks
@AlinaTaoRao AlinaTaoRao changed the title must have: add word must have 2: add a word Feb 26, 2022
@AlinaTaoRao AlinaTaoRao linked a pull request Feb 26, 2022 that will close this issue
56 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant