Skip to content

Commit

Permalink
Merge pull request #8 from PaulZhemanov/editable_titles
Browse files Browse the repository at this point in the history
Editable titles
  • Loading branch information
PaulZhemanov authored Oct 1, 2023
2 parents dc9c2c9 + 5bef79e commit 5f1c65d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/components/EditableTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ interface IProps {
const Root = styled.div`
display: flex;
flex-direction: column;
width: 165px;
height: 27px;
`
const StyledInput = styled.input<IProps>`
border: none;
Expand Down Expand Up @@ -60,12 +62,14 @@ const EditableTitle: React.FC<IProps> = ({
}

const handleTitleFix = () => {
setEditing(false)
if (title.trim() !== "") {
setEditing(false)
}
}

const handleTitleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {
if (event.key === "Enter" || event.key === "Escape") {
setEditing(false)
handleTitleFix()
}
}

Expand Down
1 change: 1 addition & 0 deletions src/components/Text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export const Text = styled.div`
font-family: Open Sans;
font-style: normal;
line-height: normal;
`
4 changes: 2 additions & 2 deletions src/components/Todolist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ const TodoList: React.FC<IProps> = () => {
color="#d71919"
fontSize="28px"
fontWeight="600"
opacity="0.3"
opacity="0.7"
showUnderline={true}
/>
<Bin className="remove-todolist-button" />
</HeaderContainer>
<SizedBox height={10} />
<SizedBox height={20} />
<TasksContainer>
<Task />
<Task />
Expand Down

0 comments on commit 5f1c65d

Please sign in to comment.