-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
68 changed files
with
6,876 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,23 @@ | ||
# vercel-merge.yml | ||
name: Deploy to vercel on merge | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
build_and_deploy: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
repository-projects: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: amondnet/vercel-action@v20 | ||
with: | ||
vercel-token: ${{ secrets.VERCEL_TOKEN }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
vercel-args: '--prod' | ||
vercel-org-id: ${{ secrets.ORG_ID}} | ||
vercel-project-id: ${{ secrets.PROJECT_ID}} | ||
scope: ${{ secrets.ORG_ID }} |
This file contains 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,26 @@ | ||
# vercel-pull-request.yml | ||
name: Create vercel preview URL on pull request | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
build_and_deploy: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
repository-projects: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: amondnet/vercel-action@v20 | ||
id: vercel-deploy | ||
with: | ||
vercel-token: ${{ secrets.VERCEL_TOKEN }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
vercel-org-id: ${{ secrets.ORG_ID }} | ||
vercel-project-id: ${{ secrets.PROJECT_ID }} | ||
scope: ${{ secrets.ORG_ID }} | ||
- name: preview-url | ||
run: | | ||
echo ${{ steps.vercel-deploy.outputs.preview-url }} |
This file contains 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,4 @@ | ||
.next | ||
node_modules | ||
.DS_Store | ||
.vercel |
This file contains 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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 Shu Ding | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains 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,23 @@ | ||
# Nextra Docs Template | ||
|
||
This is a template for creating documentation with [Nextra](https://nextra.site). | ||
|
||
[**Live Demo →**](https://nextra-docs-template.vercel.app) | ||
|
||
[![](.github/screenshot.png)](https://nextra-docs-template.vercel.app) | ||
|
||
## Quick Start | ||
|
||
Click the button to clone this repository and deploy it on Vercel: | ||
|
||
[![](https://vercel.com/button)](https://vercel.com/new/clone?s=https%3A%2F%2Fgithub.com%2Fshuding%2Fnextra-docs-template&showOptionalTeamCreation=false) | ||
|
||
## Local Development | ||
|
||
First, run `pnpm i` to install the dependencies. | ||
|
||
Then, run `pnpm dev` to start the development server and visit localhost:3000. | ||
|
||
## License | ||
|
||
This project is licensed under the MIT License. |
This file contains 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,20 @@ | ||
{ | ||
"$schema": "https://ui.shadcn.com/schema.json", | ||
"style": "default", | ||
"rsc": false, | ||
"tsx": true, | ||
"tailwind": { | ||
"config": "tailwind.config.js", | ||
"css": "styles/globals.css", | ||
"baseColor": "zinc", | ||
"cssVariables": true, | ||
"prefix": "" | ||
}, | ||
"aliases": { | ||
"components": "@/components", | ||
"utils": "@/lib/utils", | ||
"ui": "@/components/ui", | ||
"lib": "@/lib", | ||
"hooks": "@/hooks" | ||
} | ||
} |
This file contains 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,23 @@ | ||
export default function Authors({ date, children }) { | ||
return ( | ||
<div className="mb-16 mt-8 text-sm text-gray-400"> | ||
{date} by {children} | ||
</div> | ||
); | ||
} | ||
|
||
export function Author({ name, link }) { | ||
return ( | ||
<span className="after:content-[','] last:after:content-['']"> | ||
<a | ||
key={name} | ||
href={link} | ||
target="_blank" | ||
rel="noreferrer" | ||
className="mx-1 text-gray-800 dark:text-gray-100" | ||
> | ||
{name} | ||
</a> | ||
</span> | ||
); | ||
} |
This file contains 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,50 @@ | ||
import clsx from "clsx"; | ||
|
||
import { Icon } from "./icon"; | ||
import React from "react"; | ||
|
||
const styles = { | ||
note: { | ||
container: | ||
"bg-sky-50 dark:bg-slate-800/60 dark:ring-1 dark:ring-slate-300/10", | ||
title: "text-sky-900 dark:text-sky-400", | ||
body: "text-sky-800 [--tw-prose-background:theme(colors.sky.50)] prose-a:text-sky-900 prose-code:text-sky-900 dark:text-slate-300 dark:prose-code:text-slate-300", | ||
}, | ||
warning: { | ||
container: | ||
"bg-amber-50 dark:bg-slate-800/60 dark:ring-1 dark:ring-slate-300/10", | ||
title: "text-amber-900 dark:text-amber-500", | ||
body: "text-amber-800 [--tw-prose-underline:theme(colors.amber.400)] [--tw-prose-background:theme(colors.amber.50)] prose-a:text-amber-900 prose-code:text-amber-900 dark:text-slate-300 dark:[--tw-prose-underline:theme(colors.sky.700)] dark:prose-code:text-slate-300", | ||
}, | ||
}; | ||
|
||
const icons = { | ||
note: (props: Partial<React.ComponentProps<typeof Icon>>) => ( | ||
<Icon icon="lightbulb" {...props} /> | ||
), | ||
warning: (props: Partial<React.ComponentProps<typeof Icon>>) => ( | ||
<Icon icon="warning" color="amber" {...props} /> | ||
), | ||
}; | ||
|
||
export const Callout: React.FC<{ | ||
type: keyof typeof icons; | ||
title: string; | ||
children: React.ReactNode; | ||
}> = ({ type = "note", title, children }) => { | ||
let IconComponent = icons[type]; | ||
|
||
return ( | ||
<div className={clsx("my-8 flex rounded-3xl p-6", styles[type].container)}> | ||
<IconComponent className="h-8 w-8 flex-none" /> | ||
<div className="ml-4 flex-auto"> | ||
<p className={clsx("m-0 font-display text-xl", styles[type].title)}> | ||
{title} | ||
</p> | ||
<div className={clsx("prose mt-2.5", styles[type].body)}> | ||
{children} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains 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,39 @@ | ||
"use client"; | ||
|
||
import { useState } from "react"; | ||
import { Copy, Check } from "lucide-react"; | ||
import { useCopyToClipboard } from "usehooks-ts"; | ||
import { Button } from "@/components/ui/button"; | ||
|
||
interface ClipboardButtonProps { | ||
text: string; | ||
} | ||
|
||
export function ClipboardButton( | ||
{ text }: ClipboardButtonProps = { text: "Copy me!" } | ||
) { | ||
const [isCopied, setIsCopied] = useState(false); | ||
const [_, copy] = useCopyToClipboard(); | ||
|
||
const handleCopy = () => { | ||
copy(text); | ||
setIsCopied(true); | ||
setTimeout(() => setIsCopied(false), 2000); | ||
}; | ||
|
||
return ( | ||
<Button | ||
variant="outline" | ||
className="font-mono text-sm" | ||
onClick={handleCopy} | ||
aria-label={isCopied ? "Copied!" : "Copy to clipboard"} | ||
> | ||
{text} | ||
{isCopied ? ( | ||
<Check className="ml-2 h-4 w-4 text-green-500" /> | ||
) : ( | ||
<Copy className="ml-2 h-4 w-4" /> | ||
)} | ||
</Button> | ||
); | ||
} |
This file contains 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,6 @@ | ||
.counter { | ||
border: 1px solid #ccc; | ||
border-radius: 5px; | ||
padding: 2px 6px; | ||
margin: 12px 0 0; | ||
} |
This file contains 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,24 @@ | ||
// Example from https://beta.reactjs.org/learn | ||
|
||
import { useState } from 'react' | ||
import styles from './counters.module.css' | ||
|
||
function MyButton() { | ||
const [count, setCount] = useState(0) | ||
|
||
function handleClick() { | ||
setCount(count + 1) | ||
} | ||
|
||
return ( | ||
<div> | ||
<button onClick={handleClick} className={styles.counter}> | ||
Clicked {count} times | ||
</button> | ||
</div> | ||
) | ||
} | ||
|
||
export default function MyApp() { | ||
return <MyButton /> | ||
} |
This file contains 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,45 @@ | ||
.features { | ||
display: grid; | ||
grid-template-columns: 1fr 1fr 1fr 1fr; | ||
gap: 1rem 2rem; | ||
margin: 2.5rem 0 2rem; | ||
} | ||
.feature { | ||
align-items: center; | ||
display: inline-flex; | ||
} | ||
.feature h4 { | ||
margin: 0 0 0 0.5rem; | ||
font-weight: 700; | ||
font-size: 1.1rem; | ||
white-space: nowrap; | ||
} | ||
@media (max-width: 860px) { | ||
.features { | ||
gap: 1rem 0.5rem; | ||
} | ||
.feature { | ||
padding-left: 0; | ||
justify-content: center; | ||
} | ||
.feature svg { | ||
width: 20px; | ||
} | ||
.feature h4 { | ||
font-size: 0.9rem; | ||
} | ||
} | ||
@media (max-width: 660px) { | ||
.features { | ||
grid-template-columns: 1fr 1fr; | ||
} | ||
} | ||
@media (max-width: 370px) { | ||
.feature h4 { | ||
font-size: 0.8rem; | ||
} | ||
.feature svg { | ||
width: 16px; | ||
stroke-width: 2.5px; | ||
} | ||
} |
Oops, something went wrong.