-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add completed/rejected/todo screens and configure client side r…
…outing
- Loading branch information
1 parent
39f6ea5
commit ac7d4fc
Showing
19 changed files
with
331 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/components/organisms/MainContent/views/Completed/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './items-completed'; | ||
export * from './items-completed.styled'; |
17 changes: 17 additions & 0 deletions
17
src/components/organisms/MainContent/views/Completed/items-completed.hook.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { useState } from 'react'; | ||
import { ItemsCompletedProps } from './items-completed.interface'; | ||
|
||
export const useItemsCompleted = ({ tasks }: ItemsCompletedProps) => { | ||
const [filteredTasks, setFilteredTasks] = useState(tasks); | ||
const handleSearchInputChange = (phrase: string) => { | ||
const filteredTasks = tasks.filter( | ||
(task) => task.title.includes(phrase) || task.description.includes(phrase) | ||
); | ||
setFilteredTasks(filteredTasks); | ||
}; | ||
|
||
return { | ||
filteredTasks, | ||
handleSearchInputChange, | ||
}; | ||
}; |
9 changes: 9 additions & 0 deletions
9
src/components/organisms/MainContent/views/Completed/items-completed.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Task } from '../../../../../common'; | ||
|
||
export interface ItemsCompletedProps { | ||
tasks: Task[]; | ||
handleAddTaskModalClick: () => void; | ||
handleOnItemClick: (id: number) => void; | ||
handleDoneButtonClick: (id: number) => void; | ||
handleRemoveClick: (id: number) => void; | ||
} |
64 changes: 64 additions & 0 deletions
64
src/components/organisms/MainContent/views/Completed/items-completed.styled.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import styled from '@emotion/styled'; | ||
import { Button, Divider, Title } from '../../../../atoms'; | ||
import { IconInput } from '../../../../molecules'; | ||
|
||
export const ItemsCompletedContainer = styled.div` | ||
margin: 0 2em; | ||
display: flex; | ||
flex-direction: column; | ||
`; | ||
|
||
export const ItemsCompletedTitle = styled(Title)` | ||
font-size: 2.75rem; | ||
margin-top: 0.5em; | ||
padding: 0; | ||
font-weight: 900; | ||
color: var(--text-font-color); | ||
text-shadow: var(--text-box-shadow); | ||
`; | ||
|
||
export const ItemsCompletedSearchAndAdd = styled.div` | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
align-items: center; | ||
height: 3em; | ||
margin-top: 1.5em; | ||
`; | ||
|
||
export const ItemsCompletedIconInput = styled(IconInput)` | ||
height: 100%; | ||
width: calc((100% - (100% / 3)) - 0.5em); | ||
box-shadow: var(--container-box-shadow); | ||
`; | ||
|
||
export const ItemsCompletedAddButton = styled(Button)` | ||
background-color: var(--add-new-task-button-bg-color); | ||
color: var(--button-font-color); | ||
border-radius: var(--standard-border-radius); | ||
height: 100%; | ||
width: calc((100% / 3) - 0.5em); | ||
font-weight: 900; | ||
font-size: 1rem; | ||
border: var(--standard-border); | ||
transition: filter 0.3s ease-in-out; | ||
box-shadow: var(--button-box-shadow); | ||
&:hover { | ||
filter: brightness(0.9); | ||
} | ||
`; | ||
|
||
export const ItemsCompletedDivider = styled(Divider)` | ||
margin: 2em 0; | ||
background-color: var(--divider-color); | ||
`; | ||
|
||
export const ItemsCompletedList = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
`; |
43 changes: 43 additions & 0 deletions
43
src/components/organisms/MainContent/views/Completed/items-completed.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { | ||
ItemsCompletedAddButton, | ||
ItemsCompletedContainer, | ||
ItemsCompletedDivider, | ||
ItemsCompletedIconInput, | ||
ItemsCompletedList, | ||
ItemsCompletedSearchAndAdd, | ||
ItemsCompletedTitle, | ||
} from './items-completed.styled'; | ||
|
||
import { Search } from 'lucide-react'; | ||
import { TaskItem } from '../../../../molecules'; | ||
import { ItemsCompletedProps } from './items-completed.interface'; | ||
import { useItemsCompleted } from './items-completed.hook'; | ||
|
||
export const ItemsCompleted = (props: ItemsCompletedProps) => { | ||
const { | ||
handleAddTaskModalClick, | ||
handleDoneButtonClick, | ||
handleOnItemClick, | ||
handleRemoveClick, | ||
} = props; | ||
|
||
const { filteredTasks, handleSearchInputChange } = useItemsCompleted(props); | ||
|
||
return ( | ||
<ItemsCompletedContainer> | ||
<ItemsCompletedTitle title="Things completed" /> | ||
<ItemsCompletedDivider /> | ||
<ItemsCompletedList> | ||
{filteredTasks.map((task) => ( | ||
<TaskItem | ||
key={task.id} | ||
task={task} | ||
handleDoneButtonClick={handleDoneButtonClick} | ||
handleOnItemClick={handleOnItemClick} | ||
handleRemoveClick={handleRemoveClick} | ||
/> | ||
))} | ||
</ItemsCompletedList> | ||
</ItemsCompletedContainer> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './items-deleted'; | ||
export * from './items-deleted.styled'; |
17 changes: 17 additions & 0 deletions
17
src/components/organisms/MainContent/views/Deleted/items-deleted.hook.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { useState } from 'react'; | ||
import { ItemsDeletedProps } from './items-deleted.interface'; | ||
|
||
export const useItemsDeleted = ({ tasks }: ItemsDeletedProps) => { | ||
const [filteredTasks, setFilteredTasks] = useState(tasks); | ||
const handleSearchInputChange = (phrase: string) => { | ||
const filteredTasks = tasks.filter( | ||
(task) => task.title.includes(phrase) || task.description.includes(phrase) | ||
); | ||
setFilteredTasks(filteredTasks); | ||
}; | ||
|
||
return { | ||
filteredTasks, | ||
handleSearchInputChange, | ||
}; | ||
}; |
9 changes: 9 additions & 0 deletions
9
src/components/organisms/MainContent/views/Deleted/items-deleted.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Task } from '../../../../../common'; | ||
|
||
export interface ItemsDeletedProps { | ||
tasks: Task[]; | ||
handleAddTaskModalClick: () => void; | ||
handleOnItemClick: (id: number) => void; | ||
handleDoneButtonClick: (id: number) => void; | ||
handleRemoveClick: (id: number) => void; | ||
} |
64 changes: 64 additions & 0 deletions
64
src/components/organisms/MainContent/views/Deleted/items-deleted.styled.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import styled from '@emotion/styled'; | ||
import { Button, Divider, Title } from '../../../../atoms'; | ||
import { IconInput } from '../../../../molecules'; | ||
|
||
export const ItemsDeletedContainer = styled.div` | ||
margin: 0 2em; | ||
display: flex; | ||
flex-direction: column; | ||
`; | ||
|
||
export const ItemsDeletedTitle = styled(Title)` | ||
font-size: 2.75rem; | ||
margin-top: 0.5em; | ||
padding: 0; | ||
font-weight: 900; | ||
color: var(--text-font-color); | ||
text-shadow: var(--text-box-shadow); | ||
`; | ||
|
||
export const ItemsDeletedSearchAndAdd = styled.div` | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
align-items: center; | ||
height: 3em; | ||
margin-top: 1.5em; | ||
`; | ||
|
||
export const ItemsDeletedIconInput = styled(IconInput)` | ||
height: 100%; | ||
width: calc((100% - (100% / 3)) - 0.5em); | ||
box-shadow: var(--container-box-shadow); | ||
`; | ||
|
||
export const ItemsDeletedAddButton = styled(Button)` | ||
background-color: var(--add-new-task-button-bg-color); | ||
color: var(--button-font-color); | ||
border-radius: var(--standard-border-radius); | ||
height: 100%; | ||
width: calc((100% / 3) - 0.5em); | ||
font-weight: 900; | ||
font-size: 1rem; | ||
border: var(--standard-border); | ||
transition: filter 0.3s ease-in-out; | ||
box-shadow: var(--button-box-shadow); | ||
&:hover { | ||
filter: brightness(0.9); | ||
} | ||
`; | ||
|
||
export const ItemsDeletedDivider = styled(Divider)` | ||
margin: 2em 0; | ||
background-color: var(--divider-color); | ||
`; | ||
|
||
export const ItemsDeletedList = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
`; |
43 changes: 43 additions & 0 deletions
43
src/components/organisms/MainContent/views/Deleted/items-deleted.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { | ||
ItemsDeletedAddButton, | ||
ItemsDeletedContainer, | ||
ItemsDeletedDivider, | ||
ItemsDeletedIconInput, | ||
ItemsDeletedList, | ||
ItemsDeletedSearchAndAdd, | ||
ItemsDeletedTitle, | ||
} from './items-deleted.styled'; | ||
|
||
import { Search } from 'lucide-react'; | ||
import { TaskItem } from '../../../../molecules'; | ||
import { ItemsDeletedProps } from './items-deleted.interface'; | ||
import { useItemsDeleted } from './items-deleted.hook'; | ||
|
||
export const ItemsDeleted = (props: ItemsDeletedProps) => { | ||
const { | ||
handleAddTaskModalClick, | ||
handleDoneButtonClick, | ||
handleOnItemClick, | ||
handleRemoveClick, | ||
} = props; | ||
|
||
const { filteredTasks, handleSearchInputChange } = useItemsDeleted(props); | ||
|
||
return ( | ||
<ItemsDeletedContainer> | ||
<ItemsDeletedTitle title="Things deleted:" /> | ||
<ItemsDeletedDivider /> | ||
<ItemsDeletedList> | ||
{filteredTasks.map((task) => ( | ||
<TaskItem | ||
key={task.id} | ||
task={task} | ||
handleDoneButtonClick={handleDoneButtonClick} | ||
handleOnItemClick={handleOnItemClick} | ||
handleRemoveClick={handleRemoveClick} | ||
/> | ||
))} | ||
</ItemsDeletedList> | ||
</ItemsDeletedContainer> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
export * from './Todo'; | ||
export * from './Completed'; | ||
export * from './Deleted'; |
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
src/components/organisms/MainContent/views/items-rejected.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
ac7d4fc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
todo-list – ./
todo-list-git-master-wojciechmarek.vercel.app
todo-list-rust-theta.vercel.app
todo-list-wojciechmarek.vercel.app