Skip to content

Commit

Permalink
clean up new line in todo item, update todo item width calc
Browse files Browse the repository at this point in the history
  • Loading branch information
justthinguyen committed Oct 23, 2023
1 parent aa2c772 commit 81903ab
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/TodoItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const TodoItem = (ps: TodoItemProps) => (
const todoTextareaHeight = (content: string): number => {
// it works! muahaha - why these formula and numbers - no comment.
// but 25px is the min width i want to set.
const x = 25 + Math.floor(content.length * 12 / window.innerWidth) * 25;
const x = 25 + Math.floor(content.length * 15 / window.innerWidth) * 25;
// console.log([window.innerWidth, content.length, x])
return x;
}
Expand Down
2 changes: 1 addition & 1 deletion src/TodoList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const TodoList = (ps: TodoListProps) => {
}
const updateTodoAtIndex = (content: string, i: number) => {
const newTodos = [...todos];
newTodos[i].content = content;
newTodos[i].content = content.replace(/[\n\r]/g, '');
setTodos(newTodos);
}
const deleteTodoAtIndex = (i: number) => {
Expand Down

0 comments on commit 81903ab

Please sign in to comment.