diff --git a/apps/docs/.gitignore b/apps/docs/.gitignore new file mode 100644 index 0000000..2783aac --- /dev/null +++ b/apps/docs/.gitignore @@ -0,0 +1,39 @@ +node_modules/ +dist/ +*.tsbuildinfo +.DS_Store +.vercel +.netlify +_site/ +scripts/smoke/*-main/ +scripts/memory/project/src/pages/ +benchmark/projects/ +benchmark/results/ +test-results/ +*.log +package-lock.json +.turbo/ +.eslintcache +.pnpm-store + +# ignore top-level vscode settings +/.vscode/settings.json + +# do not commit .env files or any files that end with `.env` +*.env + +packages/astro/src/**/*.prebuilt.ts +packages/astro/src/**/*.prebuilt-dev.ts +!packages/astro/vendor/vite/dist +packages/integrations/**/.netlify/ + +# exclude IntelliJ/WebStorm stuff +.idea + +# ignore content collection generated files +packages/**/test/**/fixtures/**/.astro/ +packages/**/test/**/fixtures/**/env.d.ts +packages/**/e2e/**/fixtures/**/.astro/ +packages/**/e2e/**/fixtures/**/env.d.ts +examples/**/.astro/ +examples/**/env.d.ts diff --git a/apps/docs/astro.config.mjs b/apps/docs/astro.config.mjs new file mode 100644 index 0000000..b536dbb --- /dev/null +++ b/apps/docs/astro.config.mjs @@ -0,0 +1,41 @@ +import { defineConfig } from "astro/config"; +import cloudflare from "@astrojs/cloudflare"; +import tailwind from "@astrojs/tailwind"; +import { + transformerNotationDiff, + transformerNotationHighlight, + transformerNotationWordHighlight, + transformerNotationFocus, + transformerNotationErrorLevel, + transformerRenderWhitespace, + transformerMetaHighlight, + transformerMetaWordHighlight, + transformerCompactLineOptions, +} from "@shikijs/transformers"; +import mdx from "@astrojs/mdx"; + +// https://astro.build/config +export default defineConfig({ + output: "server", + devToolbar: { + enabled: false, + }, + markdown: { + shikiConfig: { + theme: "vitesse-dark", + transformers: [ + transformerNotationDiff(), + transformerNotationFocus(), + transformerMetaHighlight(), + transformerMetaWordHighlight(), + transformerNotationHighlight(), + transformerNotationWordHighlight(), + transformerNotationErrorLevel(), + transformerRenderWhitespace(), + transformerCompactLineOptions(), + ], + }, + }, + integrations: [tailwind(), mdx()], + adapter: cloudflare(), +}); diff --git a/apps/docs/next.config.js b/apps/docs/next.config.js deleted file mode 100644 index c190aeb..0000000 --- a/apps/docs/next.config.js +++ /dev/null @@ -1,9 +0,0 @@ -const withNextra = require('nextra')({ - theme: 'nextra-theme-docs', - themeConfig: './theme.config.jsx', -}); - -module.exports = withNextra(); - -// If you have other Next.js configurations, you can pass them as the parameter: -// module.exports = withNextra({ /* other next.js config */ }) diff --git a/apps/docs/package.json b/apps/docs/package.json index ddbba61..2a08b24 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -1,17 +1,28 @@ { "name": "@formbase/docs", - "version": "0.1.0", - "description": "Documentation for formbase.dev", + "version": "0.0.1", + "type": "module", "scripts": { - "build": "next build", - "dev": "next dev -p 3001", - "start": "next start" + "astro": "astro", + "build": "astro check && astro build", + "dev": "astro dev", + "preview": "astro preview", + "start": "astro dev" }, "dependencies": { - "next": "^14.2.3", - "nextra": "^2.13.4", - "nextra-theme-docs": "^2.13.4", - "react": "18.2.0", - "react-dom": "18.2.0" + "@astrojs/check": "^0.7.0", + "@astrojs/cloudflare": "^10.4.1", + "@astrojs/mdx": "^3.1.1", + "@astrojs/tailwind": "^5.1.0", + "@logsnag/astro": "^1.0.0-beta.1", + "@shikijs/transformers": "^1.6.5", + "@tailwindcss/typography": "^0.5.13", + "astro": "^4.10.2", + "astro-seo": "^0.8.4", + "clsx": "^2.1.1", + "minisearch": "^6.3.0", + "tailwind-merge": "^2.3.0", + "tailwindcss": "^3.4.4", + "typescript": "^5.4.5" } } diff --git a/apps/docs/pages/_meta.json b/apps/docs/pages/_meta.json deleted file mode 100644 index a722468..0000000 --- a/apps/docs/pages/_meta.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "index": "Getting Started" -} diff --git a/apps/docs/pages/index.mdx b/apps/docs/pages/index.mdx deleted file mode 100644 index 53463fc..0000000 --- a/apps/docs/pages/index.mdx +++ /dev/null @@ -1,75 +0,0 @@ -# Formbase Integration Documentation - -Welcome to Formbase! This documentation will guide you through the process of integrating Formbase into your applications. -We'll cover creating a form on the Formbase, retrieving the form ID, and embedding it into your HTML form. -Additionally, we'll provide details on submitting the form data using an `onsubmit` handler. - -## Table of Contents - -1. [Creating a Form on Formbase](#creating-a-form-on-formbase) -2. [Integrating Formbase into Your HTML](#integrating-formbase-into-your-html) -3. [Submitting Data with Form Action](#form-action-and-enctype) -4. [Submitting Data with an Onsubmit Handler](#submitting-data-with-an-onsubmit-handler) - -## Creating a Form on Formbase - -1. **Log in to Formbase**: Go to [Formbase](https://www.formbase.dev) and log in to your account. -2. **Create a New Form**: Navigate to the dashboard and click on `New Form`. -3. **Configure the Form**: Add the fields you need and configure as required. -4. **Save the Form**: After configuring, save the form. You will be provided with a unique `Form ID`. - -## Integrating Formbase into Your HTML - -To embed your Formbase form into your HTML, follow these steps: - -### Form Action and Enctype - -1. **HTML Form Setup**: Insert the following code snippet into your HTML file, replacing `YOUR_FORM_ID` with the Form ID you received from Formbase. - -```html - - - - - - Formbase Integration - - -
- - - - - -
- - -``` - -### Submitting Data with an Onsubmit Handler - -To submit the form data using an `onsubmit` handler, follow these steps: - -1. **Add the Onsubmit Handler**: Add the following JavaScript code snippet to your HTML file. - -```html - -``` - -That's it! You've successfully integrated Formbase into your application. If you have any questions or need further assistance, feel free to reach out to our support team. diff --git a/apps/docs/public/favicon.svg b/apps/docs/public/favicon.svg new file mode 100644 index 0000000..c2caace --- /dev/null +++ b/apps/docs/public/favicon.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/apps/docs/src/components/links.astro b/apps/docs/src/components/links.astro new file mode 100644 index 0000000..92faa9c --- /dev/null +++ b/apps/docs/src/components/links.astro @@ -0,0 +1,47 @@ +--- + +--- + + + +
+ + + + +
diff --git a/apps/docs/src/components/navbar.astro b/apps/docs/src/components/navbar.astro new file mode 100644 index 0000000..385bbb3 --- /dev/null +++ b/apps/docs/src/components/navbar.astro @@ -0,0 +1,38 @@ +--- +import Links from './links.astro'; +import Search from './search.astro'; +--- + +
+ + + + +
+ + diff --git a/apps/docs/src/components/search.astro b/apps/docs/src/components/search.astro new file mode 100644 index 0000000..217a356 --- /dev/null +++ b/apps/docs/src/components/search.astro @@ -0,0 +1,30 @@ +--- +const search = Astro.url.searchParams.get('search') || ''; +--- + +
+
+
+ + + + +
+
+
diff --git a/apps/docs/src/components/sidebar.astro b/apps/docs/src/components/sidebar.astro new file mode 100644 index 0000000..72b40cb --- /dev/null +++ b/apps/docs/src/components/sidebar.astro @@ -0,0 +1,110 @@ +--- +import { cn } from '../utils/cn'; + +interface Props { + sections: { + title: string; + subsections: { + title: string; + href: string; + }[]; + }[]; +} + +const path = Astro.url.pathname; +const sidebar = Astro.props; + +const isActive = (href: string) => path.startsWith(href); +--- + +