-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage.tsx
76 lines (72 loc) · 2.32 KB
/
page.tsx
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import Link from "next/link";
import {
Breadcrumbs,
Card,
CardContent,
CardHeader,
Link as MUILink,
Typography
} from "@mui/material";
import Users from "@/sample-data/users.json";
import Image from "next/image";
import * as React from "react";
export default function UserDetails({params}: { params: { id: string } }) {
const user = Users.find(({id}) => (id.toString() === params.id));
if (!user) {
return (
<>
<Typography variant="h4">User not found!</Typography>
<Typography>Please select another user from <Link href="/users">User list</Link></Typography>
</>
);
}
return (
<>
<Breadcrumbs sx={{mb: 3}}>
<MUILink
underline="hover"
color="inherit"
href="/"
component={Link}
>
User Management
</MUILink>
<MUILink
underline="hover"
color="inherit"
href="/users"
component={Link}
>
Users
</MUILink>
<Typography color="text.primary">
{user.firstName}
</Typography>
</Breadcrumbs>
<Card>
<CardHeader
avatar={
<Image src={user.avatarUrl || "/default-avatar.jpg"}
alt={user.firstName}
width={100}
height={100}
quality={80}
placeholder="blur"
blurDataURL="/blur-avatar.jpg"
priority
/>
}
title={`${user.firstName} ${user.lastName}`}
subheader={`${user.age} years old`}
/>
<CardContent>
<Typography variant="body2" color="text.secondary">
Email: {user.email}
<br/>
Address: {user.address}
</Typography>
</CardContent>
</Card>
</>
)
}