Added empty task list placeholder
This commit is contained in:
parent
e30ce694d2
commit
3a8411af91
20
src/components/EmptyList.tsx
Normal file
20
src/components/EmptyList.tsx
Normal file
@ -0,0 +1,20 @@
|
||||
import React from "react";
|
||||
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Box from "@mui/material/Box";
|
||||
import InboxIcon from "@mui/icons-material/Inbox";
|
||||
|
||||
export const EmptyList: React.FC = () => (
|
||||
<Box
|
||||
sx={{
|
||||
padding: (theme) => theme.spacing(1),
|
||||
paddingBottom: (theme) => theme.spacing(3),
|
||||
textAlign: "center",
|
||||
}}
|
||||
>
|
||||
<InboxIcon sx={{ fontSize: "10rem" }} color={"primary"} />
|
||||
<Typography variant={"h6"}>Empty in tasks</Typography>
|
||||
<Typography>Write first task to save it here</Typography>
|
||||
<Typography>To insert new line in task, press Shift+Enter</Typography>
|
||||
</Box>
|
||||
);
|
@ -29,7 +29,7 @@ export const Layout: React.FC<LayoutProps> = ({ appBar, content, title }) => {
|
||||
<CssBaseline />
|
||||
<Box sx={{ padding: (theme) => theme.spacing(2, 2, 10, 2) }}>
|
||||
<Typography variant="h4" sx={{ paddingLeft: 2, marginBottom: 2 }}>
|
||||
<Checkbox sx={{ visibility: "hidden" }} />
|
||||
<Checkbox aria-hidden={true} sx={{ visibility: "hidden" }} />
|
||||
{title}
|
||||
</Typography>
|
||||
{content}
|
||||
|
@ -5,17 +5,22 @@ import Paper from "@mui/material/Paper";
|
||||
|
||||
import { TodoItem } from "./TodoItem";
|
||||
import { useAppSelector } from "../hooks";
|
||||
import { EmptyList } from "./EmptyList";
|
||||
|
||||
export const TodoList: React.FC = () => {
|
||||
const tasks = useAppSelector((state) => state.todo.tasks);
|
||||
|
||||
return (
|
||||
<Paper variant="outlined">
|
||||
{tasks.length ? (
|
||||
<List>
|
||||
{tasks.map((task, index) => (
|
||||
<TodoItem key={task.id} task={task} index={index} />
|
||||
))}
|
||||
</List>
|
||||
) : (
|
||||
<EmptyList />
|
||||
)}
|
||||
</Paper>
|
||||
);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user