-
Notifications
You must be signed in to change notification settings - Fork 0
docs: rework homepage to display integration steps #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
436b09d
docs: add new homepage that displays installation steps for the payme…
bassgeta 75ddd9d
docs: add widget README.md as a documentation tab
bassgeta c6835a0
fix: errors when collapsing examples
bassgeta 334a1e6
fix: remove dash from our lib name, make markdown renderer a client o…
bassgeta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,25 @@ | ||
import { PaymentWidgetWrapper } from "./components/payment-widget-wrapper"; | ||
import { ViemAccountDemo } from "./components/viem-account-demo"; | ||
import { promises as fs } from "fs"; | ||
import path from "path"; | ||
import { HomePage } from "./components/homepage"; | ||
|
||
export default function Home() { | ||
const recipientWallet = process.env.RECIPIENT_WALLET || ""; | ||
export default async function Home() { | ||
const recipientWallet = | ||
process.env.RECIPIENT_WALLET || | ||
"0x0000000000000000000000000000000000000000"; | ||
|
||
// Load README content | ||
const readmePath = path.join( | ||
process.cwd(), | ||
"registry/default/payment-widget/README.md", | ||
); | ||
const readmeContent = await fs.readFile(readmePath, "utf8"); | ||
|
||
return ( | ||
<main className="container mx-auto py-8 px-4 space-y-8"> | ||
<h1 className="text-2xl font-bold mb-6">RequestNetwork UI Registry</h1> | ||
|
||
<div className="space-y-8"> | ||
<div> | ||
<h2 className="text-lg font-semibold mb-4"> | ||
Payment Widget Preview: | ||
</h2> | ||
<PaymentWidgetWrapper recipientWallet={recipientWallet} /> | ||
</div> | ||
|
||
<div> | ||
<ViemAccountDemo recipientWallet={recipientWallet} /> | ||
</div> | ||
</div> | ||
|
||
<div className="bg-primary p-4 rounded"> | ||
<h3 className="font-semibold mb-2">Install this component:</h3> | ||
<code className="text-sm"> | ||
npx shadcn add @requestnetwork/payment-widget | ||
</code> | ||
</div> | ||
<HomePage | ||
recipientWallet={recipientWallet} | ||
readmeContent={readmeContent} | ||
/> | ||
</main> | ||
); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
"use client"; | ||
import ReactMarkdown from "react-markdown"; | ||
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; | ||
import { darcula } from "react-syntax-highlighter/dist/esm/styles/prism"; | ||
|
||
export function MarkdownRenderer({ markdown }: { markdown: string }) { | ||
return ( | ||
<div className="prose prose-neutral dark:prose-invert max-w-none"> | ||
<ReactMarkdown | ||
components={{ | ||
// Headings | ||
h1: ({ children }) => ( | ||
<h1 className="text-3xl font-bold mb-6 text-foreground border-b border-border pb-2"> | ||
{children} | ||
</h1> | ||
), | ||
h2: ({ children }) => ( | ||
<h2 className="text-2xl font-semibold mb-4 mt-8 text-foreground"> | ||
{children} | ||
</h2> | ||
), | ||
h3: ({ children }) => ( | ||
<h3 className="text-xl font-semibold mb-3 mt-6 text-foreground"> | ||
{children} | ||
</h3> | ||
), | ||
h4: ({ children }) => ( | ||
<h4 className="text-lg font-semibold mb-2 mt-4 text-foreground"> | ||
{children} | ||
</h4> | ||
), | ||
h5: ({ children }) => ( | ||
<h5 className="text-base font-semibold mb-2 mt-4 text-foreground"> | ||
{children} | ||
</h5> | ||
), | ||
h6: ({ children }) => ( | ||
<h6 className="text-sm font-semibold mb-2 mt-4 text-foreground"> | ||
{children} | ||
</h6> | ||
), | ||
|
||
// Paragraphs | ||
p: ({ children }) => ( | ||
<p className="mb-4 text-muted-foreground leading-relaxed"> | ||
{children} | ||
</p> | ||
), | ||
|
||
// Lists | ||
ul: ({ children }) => ( | ||
<ul className="list-disc list-inside mb-4 space-y-1 text-muted-foreground ml-4"> | ||
{children} | ||
</ul> | ||
), | ||
ol: ({ children }) => ( | ||
<ol className="list-decimal list-inside mb-4 space-y-1 text-muted-foreground ml-4"> | ||
{children} | ||
</ol> | ||
), | ||
li: ({ children }) => <li className="mb-1">{children}</li>, | ||
|
||
// Links | ||
a: ({ href, children }) => ( | ||
<a | ||
href={href} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
className="text-primary hover:underline" | ||
> | ||
{children} | ||
</a> | ||
), | ||
|
||
// Emphasis | ||
strong: ({ children }) => ( | ||
<strong className="font-semibold text-foreground"> | ||
{children} | ||
</strong> | ||
), | ||
em: ({ children }) => <em className="italic">{children}</em>, | ||
|
||
// Blockquotes | ||
blockquote: ({ children }) => ( | ||
<blockquote className="border-l-4 border-primary pl-4 italic text-muted-foreground my-4 bg-muted/30 py-2"> | ||
{children} | ||
</blockquote> | ||
), | ||
|
||
// Tables | ||
table: ({ children }) => ( | ||
<div className="overflow-x-auto mb-4"> | ||
<table className="min-w-full border border-border rounded-lg"> | ||
{children} | ||
</table> | ||
</div> | ||
), | ||
thead: ({ children }) => ( | ||
<thead className="bg-muted">{children}</thead> | ||
), | ||
tbody: ({ children }) => ( | ||
<tbody className="divide-y divide-border">{children}</tbody> | ||
), | ||
tr: ({ children }) => ( | ||
<tr className="hover:bg-muted/50">{children}</tr> | ||
), | ||
th: ({ children }) => ( | ||
<th className="px-4 py-2 text-left font-semibold text-foreground"> | ||
{children} | ||
</th> | ||
), | ||
td: ({ children }) => ( | ||
<td className="px-4 py-2 text-muted-foreground">{children}</td> | ||
), | ||
|
||
// Horizontal rule | ||
hr: () => <hr className="my-8 border-border" />, | ||
|
||
// Code (inline and blocks) | ||
code(props) { | ||
const { children, className, node, ...rest } = props; | ||
const match = /language-(\w+)/.exec(className || ""); | ||
|
||
return match ? ( | ||
<div className="my-4"> | ||
<SyntaxHighlighter | ||
/* @ts-expect-error - SyntaxHighlighter types are outdated and cause style prop conflicts */ | ||
style={darcula} | ||
language={match[1]} | ||
PreTag="div" | ||
customStyle={{ | ||
margin: 0, | ||
borderRadius: "0.5rem", | ||
fontSize: "0.875rem", | ||
}} | ||
{...rest} | ||
> | ||
{String(children).replace(/\n$/, "")} | ||
</SyntaxHighlighter> | ||
</div> | ||
) : ( | ||
<code | ||
className="bg-muted px-1.5 py-0.5 rounded text-sm font-mono text-foreground" | ||
{...rest} | ||
> | ||
{children} | ||
</code> | ||
); | ||
}, | ||
|
||
// Pre (for code blocks without language) | ||
pre: ({ children }) => ( | ||
<pre className="bg-muted p-4 rounded-lg overflow-x-auto mb-4 text-sm"> | ||
{children} | ||
</pre> | ||
), | ||
}} | ||
> | ||
{markdown} | ||
</ReactMarkdown> | ||
</div> | ||
); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import * as React from "react" | ||
|
||
import { cn } from "@/lib/utils" | ||
|
||
const Card = React.forwardRef< | ||
HTMLDivElement, | ||
React.HTMLAttributes<HTMLDivElement> | ||
>(({ className, ...props }, ref) => ( | ||
<div | ||
ref={ref} | ||
className={cn( | ||
"rounded-lg border bg-card text-card-foreground shadow-sm", | ||
className | ||
)} | ||
{...props} | ||
/> | ||
)) | ||
Card.displayName = "Card" | ||
|
||
const CardHeader = React.forwardRef< | ||
HTMLDivElement, | ||
React.HTMLAttributes<HTMLDivElement> | ||
>(({ className, ...props }, ref) => ( | ||
<div | ||
ref={ref} | ||
className={cn("flex flex-col space-y-1.5 p-6", className)} | ||
{...props} | ||
/> | ||
)) | ||
CardHeader.displayName = "CardHeader" | ||
|
||
const CardTitle = React.forwardRef< | ||
HTMLDivElement, | ||
React.HTMLAttributes<HTMLDivElement> | ||
>(({ className, ...props }, ref) => ( | ||
<div | ||
ref={ref} | ||
className={cn( | ||
"text-2xl font-semibold leading-none tracking-tight", | ||
className | ||
)} | ||
{...props} | ||
/> | ||
)) | ||
CardTitle.displayName = "CardTitle" | ||
|
||
const CardDescription = React.forwardRef< | ||
HTMLDivElement, | ||
React.HTMLAttributes<HTMLDivElement> | ||
>(({ className, ...props }, ref) => ( | ||
<div | ||
ref={ref} | ||
className={cn("text-sm text-muted-foreground", className)} | ||
{...props} | ||
/> | ||
)) | ||
CardDescription.displayName = "CardDescription" | ||
|
||
const CardContent = React.forwardRef< | ||
HTMLDivElement, | ||
React.HTMLAttributes<HTMLDivElement> | ||
>(({ className, ...props }, ref) => ( | ||
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} /> | ||
)) | ||
CardContent.displayName = "CardContent" | ||
|
||
const CardFooter = React.forwardRef< | ||
HTMLDivElement, | ||
React.HTMLAttributes<HTMLDivElement> | ||
>(({ className, ...props }, ref) => ( | ||
<div | ||
ref={ref} | ||
className={cn("flex items-center p-6 pt-0", className)} | ||
{...props} | ||
/> | ||
)) | ||
CardFooter.displayName = "CardFooter" | ||
|
||
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
"use client" | ||
|
||
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible" | ||
|
||
const Collapsible = CollapsiblePrimitive.Root | ||
|
||
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger | ||
|
||
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent | ||
|
||
export { Collapsible, CollapsibleTrigger, CollapsibleContent } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.