Skip to content

Commit 5f87c27

Browse files
committed
feat(dashbored): Add avatar image and improve layout
1 parent 6b70f4f commit 5f87c27

File tree

2 files changed

+52
-7
lines changed

2 files changed

+52
-7
lines changed

src/component/dashbored/dashbored.tsx

+28-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import {UserDashBored, } from "@/server/types";
22
import {UserButton} from "@/component/layout/userbtn";
3-
import {Button, Divider, Menu, MenuItem} from "@mantine/core";
3+
import { Divider, Menu, MenuItem} from "@mantine/core";
44
import {useRouter} from "next/navigation";
5+
import Image from "next/image";
56

67
interface DashboredProps {
78
user: UserDashBored
@@ -10,16 +11,17 @@ interface DashboredProps {
1011
export const Dashbored = ({user}: DashboredProps) => {
1112
const nav = useRouter().replace;
1213
const repo = user.repos;
14+
1315
return (
1416
<div className="dashbored">
1517
<div className="dashbored-left">
1618
<div className="dashbored-left-header">
1719
<UserButton image={user.user.avatar || ""} name={user.user.username.substring(0,20)} email={user.user.name.substring(0,20)} icon={
18-
<Button onClick={() => {
20+
<span onClick={() => {
1921
nav("/u/" + user.user.username )
2022
}} className="edit">
2123
{"> go actively"}
22-
</Button>
24+
</span>
2325
}/>
2426
</div>
2527
<div className="dashbored-left-item">
@@ -28,15 +30,35 @@ export const Dashbored = ({user}: DashboredProps) => {
2830
{
2931
repo.map((item, index) => {
3032
return (
31-
<MenuItem key={index} onClick={() => {
32-
nav("/r/" + item.owner_id + "/" + item.name)
33+
<MenuItem style={{
34+
color: 'black',
35+
backgroundColor: "white",
36+
}} className="item" key={index} onClick={() => {
37+
nav("/r/" + user.user.name + "/" + item.name)
3338
}}>
34-
{item.name}
39+
<Image src={user.user.avatar || ""} alt={""} width={20} height={20} style={{
40+
borderRadius: "50%"
41+
}}/>
42+
<div>
43+
<span
44+
onClick={() => nav("/u/" + user.user.name)}
45+
>{user.user.name}</span>/<span
46+
onClick={() => nav("/r/" + user.user.name + "/" + item.name)}
47+
>{item.name}</span>
48+
</div>
3549
</MenuItem>
3650
)
3751
})
3852
}
3953
</Menu>
54+
<Divider label="group"/>
55+
<i>No Item</i>
56+
<Divider label="team"/>
57+
<i>No Item</i>
58+
<Divider label="project"/>
59+
<i>No Item</i>
60+
<Divider label="product"/>
61+
<i>No Item</i>
4062
</div>
4163
</div>
4264
<div className="dashbored-center">

src/style/dashbored.css

+24-1
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,36 @@
2828
display: flex;
2929
.edit {
3030
background: #f1f1f1;
31-
color: black;
31+
color: #222222;
32+
padding: 0.2rem 0.5rem;
33+
border-radius: 5px;
3234
}
3335
white-space: nowrap;
3436
}
3537
.dashbored-left-item {
3638
width: 100%;
3739
padding: 0 2rem;
40+
.item {
41+
padding: 0.2rem 1rem;
42+
button {
43+
background-color: white;
44+
display: flex;
45+
justify-content: space-between;
46+
align-items: center;
47+
48+
}
49+
.mantine-Menu-itemLabel {
50+
display: flex;
51+
align-items: center;
52+
gap: 0.5rem;
53+
}
54+
}
55+
i {
56+
color: #c2c2c2;
57+
font-size: 0.75rem;
58+
margin-right: 0.5rem;
59+
transition: all 0.3s ease-in-out;
60+
}
3861
}
3962
}
4063
.dashbored-center {

0 commit comments

Comments
 (0)