Skip to content

Commit b5435e1

Browse files
committed
refactor: Reuse components
1 parent b40ec31 commit b5435e1

2 files changed

Lines changed: 37 additions & 32 deletions

File tree

app/(docs)/alignment/page.tsx

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Metadata } from "next"
2-
import { PageHeader, InfoCard } from "@/components/docs-components"
2+
import { PageHeader, InfoCard, LinkCard } from "@/components/docs-components"
33
import {
44
Shield,
55
Code,
@@ -135,30 +135,20 @@ export default function AlignmentPage() {
135135
</p>
136136

137137
<div className="not-prose grid gap-4 sm:grid-cols-1 lg:grid-cols-2 mb-8">
138-
<a
138+
<LinkCard
139139
href="https://openscan.eth.link/#/1/tx/0x5dd574df963a1df1f064791e0f6ff41ec972cdbba12293b7e1ece582052ba855"
140-
target="_blank"
141-
rel="noopener noreferrer"
142-
className="block"
143-
>
144-
<InfoCard
145-
title="Ethereum Foundation Mandate"
146-
description="The EF's 1000-year charter for Ethereum — centered on CROPS, self-sovereignty, and the walkaway test. Stored on-chain and viewable via OpenScan."
147-
icon={<ExternalLink className="h-5 w-5" />}
148-
/>
149-
</a>
150-
<a
140+
title="Ethereum Foundation Mandate"
141+
description="The EF's 1000-year charter for Ethereum — centered on CROPS, self-sovereignty, and the walkaway test. Stored on-chain and viewable via OpenScan."
142+
icon={<ExternalLink className="h-5 w-5 shrink-0 text-accent" />}
143+
external
144+
/>
145+
<LinkCard
151146
href="https://trustlessness.eth.limo/general/2025/11/11/the-trustless-manifesto.html"
152-
target="_blank"
153-
rel="noopener noreferrer"
154-
className="block"
155-
>
156-
<InfoCard
157-
title="The Trustless Manifesto"
158-
description="The philosophical foundation for OpenScan's Three Laws of Trustless Design — why trustlessness matters, what it demands, and the pledge we build by."
159-
icon={<ExternalLink className="h-5 w-5" />}
160-
/>
161-
</a>
147+
title="The Trustless Manifesto"
148+
description="The philosophical foundation for OpenScan's Three Laws of Trustless Design — why trustlessness matters, what it demands, and the pledge we build by."
149+
icon={<ExternalLink className="h-5 w-5 shrink-0 text-accent" />}
150+
external
151+
/>
162152
</div>
163153
</div>
164154
)

components/docs-components.tsx

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,34 @@ interface LinkCardProps {
5555
title: string
5656
description: string
5757
icon: React.ReactNode
58+
external?: boolean
5859
}
5960

60-
export function LinkCard({ href, title, description, icon }: LinkCardProps) {
61+
export function LinkCard({ href, title, description, icon, external }: LinkCardProps) {
62+
const content = (
63+
<div className="rounded-xl border border-border bg-card p-5 transition-colors hover:border-accent/40 h-full">
64+
<h3 className="!mt-0 font-semibold text-foreground mb-1.5 flex items-center gap-2">
65+
{icon}
66+
{title}
67+
{!external && (
68+
<ArrowRight className="h-3.5 w-3.5 opacity-0 -translate-x-1 group-hover:opacity-100 group-hover:translate-x-0 transition-all" />
69+
)}
70+
</h3>
71+
<p className="text-sm leading-relaxed text-muted-foreground">{description}</p>
72+
</div>
73+
)
74+
75+
if (external) {
76+
return (
77+
<a href={href} target="_blank" rel="noopener noreferrer" className="group !no-underline hover:!no-underline">
78+
{content}
79+
</a>
80+
)
81+
}
82+
6183
return (
6284
<Link href={href} className="group !no-underline hover:!no-underline">
63-
<div className="rounded-xl border border-border bg-card p-5 transition-colors hover:border-accent/40 h-full">
64-
<h3 className="!mt-0 font-semibold text-foreground mb-1.5 flex items-center gap-2">
65-
{icon}
66-
{title}
67-
<ArrowRight className="h-3.5 w-3.5 opacity-0 -translate-x-1 group-hover:opacity-100 group-hover:translate-x-0 transition-all" />
68-
</h3>
69-
<p className="text-sm leading-relaxed text-muted-foreground">{description}</p>
70-
</div>
85+
{content}
7186
</Link>
7287
)
7388
}

0 commit comments

Comments
 (0)