Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit ff3c8c1

Browse files
committed
edit on github
1 parent 09a67c1 commit ff3c8c1

File tree

3 files changed

+35
-67
lines changed

3 files changed

+35
-67
lines changed

src/app/[[...slug]]/layout.tsx

Lines changed: 15 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -29,51 +29,30 @@ export default function DocLayout({
2929
<div className="relative grid grid-cols-12 gap-10">
3030
<div className="col-span-12 w-full flex-auto space-y-10 md:col-span-9">
3131
<Prose>{children}</Prose>
32-
<div className="grid grid-cols-2">
33-
<div className="flex flex-col items-start gap-2">
34-
<Button
35-
variant="ghost"
36-
className="group flex gap-x-2 text-sm"
37-
></Button>
38-
<Button asChild variant="ghost" className="group gap-x-2 text-sm">
39-
<a href={doc.editUrl} target="_blank" rel="noopener noreferrer">
40-
<GitHubIcon className="h-5 w-5 fill-zinc-300 transition group-hover:fill-zinc-900 dark:group-hover:fill-zinc-500" />
41-
Edit this page on GitHub
42-
</a>
43-
</Button>
44-
<Button asChild variant="ghost" className="group gap-x-2 text-sm">
45-
<a
46-
href="https://nitric.io/chat"
47-
target="_blank"
48-
rel="noopener noreferrer"
49-
>
50-
<FaDiscord className="h-5 w-5 fill-zinc-300 transition group-hover:fill-zinc-900 dark:group-hover:fill-zinc-500" />
51-
Join our Discord community
52-
</a>
53-
</Button>
54-
</div>
55-
<div className="flex flex-col items-end">
56-
<span className="text-sm text-muted-foreground">
57-
Last updated —{' '}
58-
{new Date(doc.lastModified).toLocaleDateString('en-US', {
59-
month: 'short',
60-
day: 'numeric',
61-
year: 'numeric',
62-
})}
63-
</span>
64-
</div>
32+
<div className="md:hidden">
33+
<Button asChild variant="unstyled">
34+
<a
35+
href={doc.editUrl}
36+
target="_blank"
37+
rel="noopener noreferrer"
38+
className="group flex items-center gap-x-2 text-sm dark:text-zinc-300 dark:hover:text-white"
39+
>
40+
<GitHubIcon className="h-5 w-5 fill-zinc-800 transition group-hover:fill-zinc-900 dark:fill-zinc-300 dark:group-hover:fill-white" />
41+
Edit this page on GitHub
42+
</a>
43+
</Button>
6544
</div>
6645
<div className="w-full">
6746
<Feedback />
6847
</div>
69-
<span className="text-sm text-muted-foreground">
70-
Last updated {' '}
48+
<div className="text-2xs text-muted-foreground">
49+
Last updated on{' '}
7150
{new Date(doc.lastModified).toLocaleDateString('en-US', {
7251
month: 'short',
7352
day: 'numeric',
7453
year: 'numeric',
7554
})}
76-
</span>
55+
</div>
7756
</div>
7857
<DocToc doc={doc} />
7958
</div>

src/components/layout/DocToC.tsx

Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import { FaFacebook, FaFilePdf, FaLinkedin } from 'react-icons/fa'
88
import { DocTracingBeam } from './DocTracingBeam'
99
import { BASE_URL } from '@/lib/constants'
1010
import { title } from 'radash'
11+
import { Button } from '../ui/button'
12+
import { GitHubIcon } from '../icons/GitHubIcon'
1113

1214
interface Props {
1315
doc: Doc
@@ -24,30 +26,21 @@ const DocToC: React.FC<Props> = ({ doc }) => {
2426
const articleRef = useRef<HTMLDivElement>(null)
2527

2628
return (
27-
<div className="h-full min-w-40" ref={articleRef}>
29+
<div className="h-full min-w-52" ref={articleRef}>
2830
<aside className="sticky top-[calc(var(--header-height)+1px+2rem)] hidden max-h-[calc(100vh-var(--header-height)-3rem)] min-w-40 space-y-6 md:block">
29-
{/* <div className="flex flex-wrap gap-2">
30-
{post.categories.map((category) => (
31-
<Link key={category} href={`/blog/category/${category}`}>
32-
<Badge variant="outline" className="bg-zinc-600/10">
33-
{title(category)}
34-
</Badge>
35-
</Link>
36-
))}
37-
</div> */}
3831
{doc.toc.length ? (
3932
<div className="relative flex flex-col">
40-
<p className="mb-2 font-mono text-sm uppercase text-zinc-300">
33+
<p className="mb-2 font-mono text-sm uppercase dark:text-zinc-300">
4134
On this page
4235
</p>
4336
<DocTracingBeam targetRef={articleRef}>
44-
<ol className="flex flex-col gap-y-1 pl-4 text-sm font-medium text-zinc-300">
37+
<ol className="flex flex-col gap-y-1 pl-4 text-sm font-medium">
4538
{doc.toc.map((item: Toc, i: number) => {
4639
return (
4740
<li key={item.url + i}>
4841
<Link
4942
href={item.url}
50-
className="text-2xs transition-colors hover:text-zinc-200"
43+
className="text-2xs text-muted-foreground transition-colors hover:text-zinc-900 dark:hover:text-zinc-200"
5144
>
5245
{item.value}
5346
</Link>
@@ -58,23 +51,19 @@ const DocToC: React.FC<Props> = ({ doc }) => {
5851
</DocTracingBeam>
5952
</div>
6053
) : null}
61-
62-
{/* <div>
63-
<p className="mb-2 text-sm">Share</p>
64-
<div className="flex gap-2">
65-
{socials.map((social) => (
66-
<Link
67-
rel="noopener noreferrer"
68-
target="_blank"
69-
key={social.href}
70-
aria-label={`Share on ${social.name}`}
71-
href={social.href}
72-
>
73-
<social.icon className="size-5 text-zinc-300 transition-colors hover:text-zinc-100" />
74-
</Link>
75-
))}
76-
</div>
77-
</div> */}
54+
<div>
55+
<Button asChild variant="unstyled">
56+
<a
57+
href={doc.editUrl}
58+
target="_blank"
59+
rel="noopener noreferrer"
60+
className="group flex items-center gap-x-2 text-xs dark:text-zinc-300 dark:hover:text-white"
61+
>
62+
<GitHubIcon className="h-5 w-5 fill-zinc-800 transition group-hover:fill-zinc-900 dark:fill-zinc-300 dark:group-hover:fill-white" />
63+
Edit this page on GitHub
64+
</a>
65+
</Button>
66+
</div>
7867
</aside>
7968
</div>
8069
)

src/components/layout/DocTracingBeam.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export const DocTracingBeam = ({
5858
<motion.path
5959
d={`M 1 0V -36 l 18 24 V ${svgHeight * 0.98}`}
6060
fill="none"
61-
className={`stroke-zinc-200`}
61+
className={`stroke-zinc-400 dark:stroke-zinc-200`}
6262
strokeOpacity="0.16"
6363
transition={{
6464
duration: 10,

0 commit comments

Comments
 (0)