Skip to content

Commit

Permalink
extra-docs default template
Browse files Browse the repository at this point in the history
  • Loading branch information
meetqy committed Sep 17, 2023
1 parent edc8909 commit decf583
Show file tree
Hide file tree
Showing 20 changed files with 2,442 additions and 2 deletions.
42 changes: 42 additions & 0 deletions apps/nextra-docs/components/OptionTable/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import styles from "./style.module.css";

export function OptionTable({
options,
}: {
options: [JSX.Element, JSX.Element, JSX.Element][];
}) {
return (
<div
className={
"-mx-6 mb-4 mt-6 overflow-x-auto overscroll-x-contain px-6 pb-4 " +
styles.container
}
>
<table className="w-full border-collapse text-sm">
<thead>
<tr className="border-b py-4 text-left dark:border-neutral-700">
<th className="py-2 font-semibold">Option</th>
<th className="py-2 pl-6 font-semibold">Type</th>
<th className="px-6 py-2 font-semibold">Description</th>
</tr>
</thead>
<tbody className="align-baseline text-gray-900 dark:text-gray-100">
{options.map(([option, type, description], index) => (
<tr
key={index}
className="border-b border-gray-100 dark:border-neutral-700/50"
>
<td className="whitespace-pre py-2 font-mono text-xs font-semibold leading-6 text-violet-600 dark:text-violet-500">
{option}
</td>
<td className="whitespace-pre py-2 pl-6 font-mono text-xs font-semibold leading-6 text-slate-500 dark:text-slate-400">
{type}
</td>
<td className="py-2 pl-6">{description}</td>
</tr>
))}
</tbody>
</table>
</div>
);
}
13 changes: 13 additions & 0 deletions apps/nextra-docs/components/OptionTable/style.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.container {
mask-image: linear-gradient(
to right,
transparent 0.8em,
white 1.5em,
white calc(100% - 1.5em),
transparent calc(100% - 0.8em)
);
}

.container::-webkit-scrollbar {
appearance: none;
}
6 changes: 6 additions & 0 deletions apps/nextra-docs/components/counters.module.css
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;
}
24 changes: 24 additions & 0 deletions apps/nextra-docs/components/counters.tsx
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 />
}
12 changes: 12 additions & 0 deletions apps/nextra-docs/next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import nextra from "nextra";

const withNextra = nextra({
theme: "nextra-theme-docs",
themeConfig: "./theme.config.tsx",
});

export default withNextra({
reactStrictMode: true,
eslint: { ignoreDuringBuilds: true },
typescript: { ignoreBuildErrors: true },
});
32 changes: 32 additions & 0 deletions apps/nextra-docs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "nextra-docs-template",
"version": "0.0.1",
"description": "Nextra docs template",
"scripts": {
"build": "next build",
"dev": "next dev",
"start": "next start"
},
"prettier": "@rao-pics/prettier-config",
"eslintConfig": {
"extends": [
"@rao-pics/eslint-config/base",
"@rao-pics/eslint-config/nextjs",
"@rao-pics/eslint-config/react"
],
"root": true
},
"dependencies": {
"next": "^13.4.19",
"nextra": "latest",
"nextra-theme-docs": "latest",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@rao-pics/eslint-config": "workspace:*",
"@rao-pics/prettier-config": "workspace:*",
"@rao-pics/tailwind-config": "workspace:*",
"@rao-pics/tsconfig": "workspace:*"
}
}
5 changes: 5 additions & 0 deletions apps/nextra-docs/pages/_app.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import "../style.css";

export default function App({ Component, pageProps }) {
return <Component {...pageProps} />;
}
15 changes: 15 additions & 0 deletions apps/nextra-docs/pages/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"index": "Introduction",
"another": "Another Page",
"advanced": "Advanced (A Folder)",
"about": {
"title": "About",
"type": "page"
},
"contact": {
"title": "Contact ↗",
"type": "page",
"href": "https://twitter.com/shuding_",
"newWindow": true
}
}
3 changes: 3 additions & 0 deletions apps/nextra-docs/pages/about.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# About

This is the about page! This page is shown on the navbar.
3 changes: 3 additions & 0 deletions apps/nextra-docs/pages/advanced.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Advanced

This is the index page for the Advanced folder!
3 changes: 3 additions & 0 deletions apps/nextra-docs/pages/advanced/satori.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Satori

Satori (悟り) is a Japanese Buddhist term for awakening, "comprehension; understanding".
37 changes: 37 additions & 0 deletions apps/nextra-docs/pages/another.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Another Page

```js filename="demo.js" {3} copy
let a = 1;

console.log(a);
```

import { OptionTable } from "@components/OptionTable";

<OptionTable options={[[1, 2, 3]]} />

## Component

import { useState } from "react";

{/* Import CSS modules */}
import styles from '../components/counters.module.css'

export const Counter = () => {
const [count, setCount] = useState(0);
return (
<div>
<button onClick={() => setCount(count + 1)} className={styles.counter}>
Clicked {count} times
</button>
</div>
);
};

<Counter />

## External Component

import Counters from "../components/counters";

<Counters />
11 changes: 11 additions & 0 deletions apps/nextra-docs/pages/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Introduction

Welcome to Nextra! This is a basic docs template. You can use it as a starting point for your own project :)

## What is Nextra?

A **simple**, **powerful** and **flexible** site generation framework with everything you love from Next.js.

## Documentation

The documentation is available at [https://nextra.site](https://nextra.site).
Loading

0 comments on commit decf583

Please sign in to comment.