Skip to content

Commit 87bd99b

Browse files
committed
Merge branch 'main' of github.com:ArianHamdi/todo-topia
2 parents 1476641 + cc31ade commit 87bd99b

File tree

5 files changed

+46
-8
lines changed

5 files changed

+46
-8
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.emptyState {
2+
@include flex-center;
3+
width: 100%;
4+
margin-top: 30px;
5+
}
6+
7+
.message {
8+
@include flex-center;
9+
flex-direction: column;
10+
width: 220px;
11+
background-color: $color-bg;
12+
padding: 30px 0;
13+
border-radius: 8px;
14+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
15+
}
16+
17+
.icon {
18+
fill: $color-footer-text;
19+
margin-bottom: 20px;
20+
}
+8-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
import styles from './EmptyState.module.scss';
2+
import Icon from '@/assets/icons/bots.svg';
23

34
const EmptyState = () => {
4-
return <div>EmptyState</div>;
5+
return (
6+
<div className={styles.emptyState}>
7+
<div className={styles.message}>
8+
<Icon width={50} height={50} className={styles.icon} /> Empty!
9+
</div>
10+
</div>
11+
);
512
};
613

714
export default EmptyState;

src/containers/Category/Category.tsx

+8-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import TodoList from '@/components/TodoList';
1111
import Header from '@/components/Header';
1212
import { useBackButton } from '@/hooks/useBackButton';
1313
import Spinner from '@/components/Spinner';
14+
import EmptyState from '@/components/EmptyState/EmptyState';
1415

1516
const Category = () => {
1617
const {
@@ -73,9 +74,13 @@ const Category = () => {
7374
<LinkButton href={`/create/category/${categoryId}/todo-list`}>
7475
{t('new_todo_list')}
7576
</LinkButton>
76-
{data?.todoLists?.map(todoList => (
77-
<TodoList key={todoList.id} {...todoList} />
78-
))}
77+
{data.todoLists.length === 0 ? (
78+
<EmptyState />
79+
) : (
80+
data?.todoLists?.map(todoList => (
81+
<TodoList key={todoList.id} {...todoList} />
82+
))
83+
)}
7984
</div>
8085
</div>
8186
);

src/containers/Landing/Landing.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import LinkButton from '@/components/LinkButton';
66
import Profile from '@/components/Profile';
77
import { useBackButton } from '@/hooks/useBackButton';
88
import Spinner from '@/components/Spinner';
9+
import EmptyState from '@/components/EmptyState/EmptyState';
910

1011
const Landing = () => {
1112
useBackButton();
@@ -25,7 +26,9 @@ const Landing = () => {
2526
<h1>{t('task_categories')}</h1>
2627
</div>
2728
<LinkButton href='/create/category'>{t('new_category')}</LinkButton>
28-
<div className={styles.categories}>{items}</div>
29+
<div className={styles.categories}>
30+
{data?.length === 0 ? <EmptyState /> : items}
31+
</div>
2932
</div>
3033
);
3134
};

src/containers/TodoList/TodoList.tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { useDeleteTodoList, useTodoList } from '@/hooks/api/todo-list';
1212
import Header from '@/components/Header';
1313
import { useBackButton } from '@/hooks/useBackButton';
1414
import Spinner from '@/components/Spinner';
15+
import EmptyState from '@/components/EmptyState/EmptyState';
1516

1617
const TodoList = () => {
1718
const {
@@ -73,9 +74,11 @@ const TodoList = () => {
7374
<LinkButton href={`/create/todo-list/${todoListId}/task`}>
7475
{t('new_task')}
7576
</LinkButton>
76-
{data.tasks.map(task => (
77-
<Task key={task.id} {...task} />
78-
))}
77+
{data.tasks.length === 0 ? (
78+
<EmptyState />
79+
) : (
80+
data.tasks.map(task => <Task key={task.id} {...task} />)
81+
)}
7982
</div>
8083
</div>
8184
);

0 commit comments

Comments
 (0)