Skip to content

Commit 3f4a3a3

Browse files
authored
Merge pull request #638 from LGLabGreg/claude/wonderful-hamilton-05jd6f
Redesign homepage and improve code display components
2 parents c653ef9 + b6315d9 commit 3f4a3a3

21 files changed

Lines changed: 371 additions & 240 deletions

‎apps/docs/next-env.d.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3-
import './.next/dev/types/routes.d.ts'
3+
import './.next/types/routes.d.ts'
4+
import './.next/types/root-params.d.ts'
45

56
// NOTE: This file should not be edited
67
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

‎apps/docs/src/app/globals.css‎

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@
44

55
@custom-variant dark (&:is(.dark *));
66

7+
@theme inline {
8+
--font-mono: var(--font-source-code), ui-monospace, monospace;
9+
}
10+
711
@theme {
8-
--font-mono: 'Source Code Pro', 'sans-serif';
12+
--color-brand: hsl(var(--brand));
913

1014
--color-background: hsl(var(--background));
1115
--color-foreground: hsl(var(--foreground));
@@ -89,54 +93,58 @@
8993
::before,
9094
::backdrop,
9195
::file-selector-button {
92-
border-color: var(--color-gray-200, currentColor);
96+
border-color: var(--color-border, currentColor);
9397
}
9498
}
9599

96100
@layer utilities {
97101
body {
98102
font-family: var(--font-inter);
99103
font-size: 15px;
104+
font-feature-settings: 'cv11', 'ss01';
105+
text-rendering: optimizeLegibility;
100106
}
101107
}
102108

103109
@layer base {
104110
:root {
105111
--background: 0 0% 100%;
106-
--foreground: 0 0% 3.9%;
112+
--foreground: 240 10% 3.9%;
107113
--card: 0 0% 100%;
108-
--card-foreground: 0 0% 3.9%;
114+
--card-foreground: 240 10% 3.9%;
109115
--popover: 0 0% 100%;
110-
--popover-foreground: 0 0% 3.9%;
111-
--primary: 0 0% 9%;
116+
--popover-foreground: 240 10% 3.9%;
117+
--primary: 240 5.9% 10%;
112118
--primary-foreground: 0 0% 98%;
113-
--secondary: 0 0% 96.1%;
114-
--secondary-foreground: 0 0% 9%;
115-
--muted: 0 0% 96.1%;
116-
--muted-foreground: 0 0% 45.1%;
117-
--accent: 0 0% 96.1%;
118-
--accent-foreground: 0 0% 9%;
119+
--secondary: 240 4.8% 95.9%;
120+
--secondary-foreground: 240 5.9% 10%;
121+
--muted: 240 4.8% 95.9%;
122+
--muted-foreground: 240 3.8% 46.1%;
123+
--accent: 240 4.8% 95.9%;
124+
--accent-foreground: 240 5.9% 10%;
119125
--destructive: 0 84.2% 60.2%;
120126
--destructive-foreground: 0 0% 98%;
121-
--border: 0 0% 89.8%;
122-
--input: 0 0% 89.8%;
123-
--ring: 0 0% 3.9%;
127+
--border: 240 5.9% 90%;
128+
--input: 240 5.9% 90%;
129+
--ring: 240 5.9% 10%;
130+
--brand: 183 100% 38%;
124131
--chart-1: 12 76% 61%;
125132
--chart-2: 173 58% 39%;
126133
--chart-3: 197 37% 24%;
127134
--chart-4: 43 74% 66%;
128135
--chart-5: 27 87% 67%;
129136
--radius: 0.5rem;
130-
--sidebar-background: 0 0% 98%;
131-
--sidebar-foreground: 240 5.3% 26.1%;
137+
--sidebar-background: 0 0% 100%;
138+
--sidebar-foreground: 240 3.8% 46.1%;
132139
--sidebar-primary: 240 5.9% 10%;
133140
--sidebar-primary-foreground: 0 0% 98%;
134141
--sidebar-accent: 240 4.8% 95.9%;
135142
--sidebar-accent-foreground: 240 5.9% 10%;
136-
--sidebar-border: 220 13% 91%;
143+
--sidebar-border: 240 5.9% 90%;
137144
--sidebar-ring: 217.2 91.2% 59.8%;
138145
}
139146
.dark {
147+
--brand: 183 100% 40%;
140148
--background: 0 0% 3.9%;
141149
--foreground: 0 0% 98%;
142150
--card: 0 0% 3.9%;
@@ -179,6 +187,9 @@
179187
body {
180188
@apply bg-background text-foreground;
181189
}
190+
::selection {
191+
background-color: hsl(var(--brand) / 0.2);
192+
}
182193
hr {
183194
@apply my-5;
184195
}

‎apps/docs/src/app/installation/page.tsx‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@ export default function Page() {
1818
Setting up <TypographyBold>@lglab/react-qr-code</TypographyBold> is quick and
1919
easy. Install it using your favourite package manager:
2020
</TypographyP>
21-
<CodeBlock code='pnpm add @lglab/react-qr-code' title='pnpm' />
22-
<CodeBlock code='npm i @lglab/react-qr-code' title='npm' />
23-
<CodeBlock code='yarn add @lglab/react-qr-code' title='yarn' />
24-
<CodeBlock code='bun add @lglab/react-qr-code' title='bun' />
21+
<CodeBlock
22+
commands={[
23+
{ title: 'pnpm', code: 'pnpm add @lglab/react-qr-code' },
24+
{ title: 'npm', code: 'npm i @lglab/react-qr-code' },
25+
{ title: 'yarn', code: 'yarn add @lglab/react-qr-code' },
26+
{ title: 'bun', code: 'bun add @lglab/react-qr-code' },
27+
]}
28+
/>
2529
</>
2630
)
2731
}

‎apps/docs/src/app/layout.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const inter = Inter({
1414
})
1515

1616
const mono = Source_Code_Pro({
17-
variable: '--font-mono',
17+
variable: '--font-source-code',
1818
subsets: ['latin'],
1919
})
2020

‎apps/docs/src/app/page.tsx‎

Lines changed: 65 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
1-
import { Code, Layers, Sparkles, Zap } from 'lucide-react'
1+
import { ArrowRight, Bot, Code, Layers, Sparkles, Zap } from 'lucide-react'
22
import type { Metadata } from 'next'
33
import Link from 'next/link'
44

55
import { Hero } from '@/components/hero'
6-
import {
7-
Card,
8-
CardContent,
9-
CardDescription,
10-
CardHeader,
11-
CardTitle,
12-
} from '@/components/ui/card'
136
import { TypographyBold } from '@/components/ui/typography'
147

158
export const metadata: Metadata = {
@@ -20,77 +13,78 @@ export const metadata: Metadata = {
2013
'React QR Code is a highly customizable and lightweight QR code generator for React applications. Easily style QR codes with unique finder patterns, rounded corners, and customizable colors.',
2114
}
2215

23-
export default function Page() {
24-
const features = [
25-
{
26-
title: 'Highly Customizable',
27-
description:
28-
'Style finder patterns, modules, and colors exactly how you want with advanced configuration.',
29-
icon: <Sparkles className='h-4 w-4 text-primary' />,
30-
},
31-
{
32-
title: 'Performance Optimized',
33-
description:
34-
'Generates QR codes efficiently without sacrificing quality or bundle size.',
35-
icon: <Zap className='h-4 w-4 text-primary' />,
36-
},
37-
{
38-
title: 'SVG-Based Rendering',
39-
description: 'Crisp and scalable output for web and print, powered by SVG.',
40-
icon: <Layers className='h-4 w-4 text-primary' />,
41-
},
42-
{
43-
title: 'Developer-Friendly',
44-
description:
45-
'Built with TypeScript, easy to use, and focused on a great developer experience.',
46-
icon: <Code className='h-4 w-4 text-primary' />,
47-
},
48-
]
16+
const features = [
17+
{
18+
title: 'Highly Customizable',
19+
description:
20+
'Style finder patterns, modules, and colors exactly how you want with advanced configuration.',
21+
icon: Sparkles,
22+
},
23+
{
24+
title: 'Performance Optimized',
25+
description:
26+
'Generates QR codes efficiently without sacrificing quality or bundle size.',
27+
icon: Zap,
28+
},
29+
{
30+
title: 'SVG-Based Rendering',
31+
description: 'Crisp and scalable output for web and print, powered by SVG.',
32+
icon: Layers,
33+
},
34+
{
35+
title: 'Developer-Friendly',
36+
description:
37+
'Built with TypeScript, easy to use, and focused on a great developer experience.',
38+
icon: Code,
39+
},
40+
]
41+
42+
const FeatureIcon = ({ icon: Icon }: { icon: typeof Sparkles }) => (
43+
<div className='inline-flex size-9 shrink-0 items-center justify-center rounded-lg border bg-background shadow-xs'>
44+
<Icon className='size-4 text-brand' />
45+
</div>
46+
)
4947

48+
export default function Page() {
5049
return (
5150
<>
5251
<Hero />
53-
<div className='mb-4 grid grid-cols-1 gap-4 lg:grid-cols-2 max-w-full md:max-w-4xl mx-auto'>
54-
{features.map((feature) => (
55-
<Card key={feature.title} className='shadow-xs'>
56-
<CardHeader className='flex-row items-start gap-4 space-y-0'>
57-
<div className='mb-2 inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-background shadow-sm'>
58-
{feature.icon}
59-
</div>
60-
<div className='space-y-1'>
61-
<CardTitle className='text-lg'>{feature.title}</CardTitle>
62-
<CardDescription className='text-sm leading-relaxed'>
52+
<div className='mx-auto w-full max-w-4xl'>
53+
<div className='grid grid-cols-1 overflow-hidden rounded-xl border bg-border gap-px sm:grid-cols-2'>
54+
{features.map((feature) => (
55+
<div key={feature.title} className='flex flex-col gap-4 bg-background p-6'>
56+
<FeatureIcon icon={feature.icon} />
57+
<div className='space-y-1.5'>
58+
<h3 className='font-semibold tracking-tight'>{feature.title}</h3>
59+
<p className='text-sm leading-relaxed text-muted-foreground'>
6360
{feature.description}
64-
</CardDescription>
61+
</p>
6562
</div>
66-
</CardHeader>
67-
</Card>
68-
))}
69-
</div>
63+
</div>
64+
))}
65+
</div>
7066

71-
<Card className='max-w-full md:max-w-4xl mx-auto shadow-xs'>
72-
<CardHeader className='flex-row items-start gap-4 space-y-0'>
73-
<div className='mt-1 shrink-0 rounded-lg bg-background p-2 shadow-sm'>
74-
<Sparkles className='h-4 w-4 text-primary' />
67+
<Link
68+
href='/llms-txt'
69+
className='group mt-4 flex flex-col gap-4 rounded-xl border bg-muted/40 p-6 transition-colors hover:bg-muted/70 sm:flex-row sm:items-center'
70+
>
71+
<FeatureIcon icon={Bot} />
72+
<div className='flex-1 space-y-1.5'>
73+
<h3 className='font-semibold tracking-tight'>Optimized for AI</h3>
74+
<p className='text-sm leading-relaxed text-muted-foreground'>
75+
We provide{' '}
76+
<TypographyBold className='text-foreground'>llms.txt</TypographyBold> and{' '}
77+
<TypographyBold className='text-foreground'>llms-full.txt</TypographyBold>{' '}
78+
files to help tools like Cursor and Windsurf understand the library
79+
documentation instantly.
80+
</p>
7581
</div>
76-
<div>
77-
<CardTitle className='mb-1 text-xl'>Optimized for AI</CardTitle>
78-
<CardDescription className='text-base text-foreground/80'>
79-
We provide <TypographyBold>llms.txt</TypographyBold> and{' '}
80-
<TypographyBold>llms-full.txt</TypographyBold> files to help tools like
81-
Cursor and Windsurf understand the library documentation instantly.
82-
</CardDescription>
83-
</div>
84-
</CardHeader>
85-
<CardContent className='pt-0'>
86-
<Link
87-
href='/llms-txt'
88-
className='ml-14 inline-flex items-center gap-1 font-medium text-primary hover:underline'
89-
>
90-
Learn how to use with AI tools →
91-
</Link>
92-
</CardContent>
93-
</Card>
82+
<span className='inline-flex items-center gap-1 text-sm font-medium whitespace-nowrap'>
83+
Learn more
84+
<ArrowRight className='size-4 transition-transform group-hover:translate-x-0.5' />
85+
</span>
86+
</Link>
87+
</div>
9488
</>
9589
)
9690
}

‎apps/docs/src/components/api-table.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const APITable = ({ props }: { props: Prop[] }) => (
2121
<TableBody>
2222
{props.map((prop) => (
2323
<TableRow key={prop.name}>
24-
<TableCell className='font-medium'>{prop.name}</TableCell>
24+
<TableCell className='font-mono text-[13px] font-medium'>{prop.name}</TableCell>
2525
<TableCell>
2626
<PropTypeTag type={prop.type} />
2727
</TableCell>
Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,47 @@
11
'use client'
22

3-
import { Check, Copy } from 'lucide-react'
43
import { useState } from 'react'
54

6-
import { Button } from '@/components/ui/button'
7-
import { Card, CardContent } from '@/components/ui/card'
5+
import { cn } from '@/lib/utils'
6+
7+
import { CopyButton } from './copy-button'
88

99
interface CodeBlockProps {
10-
code: string
11-
title?: string
10+
commands: { title: string; code: string }[]
1211
}
1312

14-
export const CodeBlock = ({ code, title = '' }: CodeBlockProps) => {
15-
const [isCopied, setIsCopied] = useState(false)
16-
17-
const copyToClipboard = async () => {
18-
await navigator.clipboard.writeText(code)
19-
setIsCopied(true)
20-
setTimeout(() => setIsCopied(false), 2000)
21-
}
13+
export const CodeBlock = ({ commands }: CodeBlockProps) => {
14+
const [active, setActive] = useState(0)
15+
const { code } = commands[active]
2216

2317
return (
24-
<Card className='mb-4'>
25-
<CardContent className='p-0'>
26-
<div className='flex items-center justify-between bg-muted px-4 py-2'>
27-
<span className='text-sm font-medium text-muted-foreground'>{title}</span>
28-
<Button
29-
variant='ghost'
30-
size='sm'
31-
onClick={copyToClipboard}
32-
className='h-8 w-8 p-0 cursor-pointer'
33-
>
34-
{isCopied ? <Check className='h-4 w-4' /> : <Copy className='h-4 w-4' />}
35-
<span className='sr-only'>
36-
{isCopied ? 'Copied' : 'Copy code to clipboard'}
37-
</span>
38-
</Button>
18+
<div className='mb-4 overflow-hidden rounded-xl border border-zinc-800 bg-zinc-950 shadow-sm'>
19+
<div className='flex h-10 items-center justify-between border-b border-zinc-800 pl-2 pr-2'>
20+
<div className='flex items-center gap-1' role='tablist'>
21+
{commands.map(({ title }, i) => (
22+
<button
23+
key={title}
24+
type='button'
25+
role='tab'
26+
aria-selected={i === active}
27+
onClick={() => setActive(i)}
28+
className={cn(
29+
'h-7 cursor-pointer rounded-md px-2.5 font-mono text-xs text-zinc-400 transition-colors hover:text-zinc-100',
30+
i === active && 'bg-white/10 text-zinc-50',
31+
)}
32+
>
33+
{title}
34+
</button>
35+
))}
3936
</div>
40-
<pre className='overflow-x-auto p-4'>
41-
<code className='text-sm'>{code}</code>
42-
</pre>
43-
</CardContent>
44-
</Card>
37+
<CopyButton value={code} />
38+
</div>
39+
<pre className='overflow-x-auto p-4'>
40+
<code className='font-mono text-sm text-zinc-100'>
41+
<span className='select-none text-zinc-500'>$ </span>
42+
{code}
43+
</code>
44+
</pre>
45+
</div>
4546
)
4647
}

0 commit comments

Comments
 (0)