Skip to content

Commit 28f1404

Browse files
committed
feat(repo): Add repo intro section to repository page
1 parent a12a176 commit 28f1404

File tree

2 files changed

+60
-1
lines changed

2 files changed

+60
-1
lines changed

src/app/(default)/r/[owner]/[repo]/(default)/page.tsx

+9-1
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ import {FileAction} from "@/component/repo/fileaction";
1111
import {Loader} from "@mantine/core";
1212
import dayjs from "dayjs";
1313
import relativeTime from "dayjs/plugin/relativeTime";
14+
import {RepoIntro} from "@/component/repo/repointro";
1415

1516
dayjs.extend(relativeTime);
1617

1718

1819
export default function RepositoryPage() {
1920
const [Repo, setRepo] = useState<Repository | undefined>()
2021
const [Loading, setLoading] = useState(false);
21-
const [Tab, setTab] = useState('');
22+
const [Tab, setTab] = useState('intro');
2223
const [Owner, setOwner] = useState({
2324
owner: '',
2425
repo: ''
@@ -188,6 +189,13 @@ export default function RepositoryPage() {
188189
</div>
189190
)
190191
}
192+
{
193+
Tab === 'intro' && (
194+
<div className="intro-page">
195+
<RepoIntro repo={Repo} owner={Owner.owner} branch={DefaultBranch} head={HeadCommit} />
196+
</div>
197+
)
198+
}
191199
</>
192200
)
193201
}

src/style/repo.css

+51
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,55 @@
124124
flex-direction: column;
125125
gap: 1rem;
126126
}
127+
}
128+
129+
.repo-intro {
130+
display: flex;
131+
.repo-readme {
132+
width: auto;
133+
}
134+
.repo-intro-card {
135+
@media screen and (max-width: 1500px) {
136+
display: none;
137+
}
138+
border: 1px #dddddd solid;
139+
border-top: none;
140+
min-width: 360px;
141+
max-height: 60vh;
142+
.clone-url {
143+
padding: 0.25rem;
144+
}
145+
.repo-intro-card-title {
146+
padding: 1rem;
147+
h1 {
148+
font-size: 1.5rem;
149+
}
150+
span {
151+
font-size: 1rem;
152+
}
153+
}
154+
.repo-intro-card-list {
155+
display: flex;
156+
flex-direction: column;
157+
gap: 0.25rem;
158+
justify-content: flex-start;
159+
padding: 0.5rem 0.25rem;
160+
max-width: 45%;
161+
}
162+
163+
.repo-intro-card-list-item {
164+
display: flex;
165+
justify-content: space-between;
166+
align-items: center;
167+
}
168+
169+
.repo-intro-card-list-item a {
170+
color: #0087ed;
171+
cursor: pointer;
172+
}
173+
174+
.repo-intro-card-list-item span {
175+
font-size: 1rem;
176+
}
177+
}
127178
}

0 commit comments

Comments
 (0)