-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy pathindex.tsx
More file actions
34 lines (29 loc) · 1004 Bytes
/
index.tsx
File metadata and controls
34 lines (29 loc) · 1004 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { Bar } from '@ui5/webcomponents-react/Bar';
import { Page } from '@ui5/webcomponents-react/Page';
import { Title } from '@ui5/webcomponents-react/Title';
import type { MetaFunction } from 'react-router';
import { TodoList } from '~/components/TodoList';
import { Todo, todos } from '~/mockData/todos';
import type { Route } from './+types/index';
export const meta: MetaFunction = () => {
return [
{ title: 'UI5 Web Components React - React Router Example' },
{ name: 'description', content: 'Welcome to this example!' },
];
};
export async function loader() {
const todoList = await new Promise<Todo[]>((resolve) => {
setTimeout(() => {
resolve(todos);
}, 1500);
});
return { todos: todoList };
}
export default function Index({ loaderData }: Route.ComponentProps) {
const { todos } = loaderData;
return (
<Page header={<Bar style={{ paddingInline: 0 }} startContent={<Title>My Todos</Title>} />}>
<TodoList items={todos} />
</Page>
);
}