Skip to content

Commit 12bf92d

Browse files
committed
chore: format
1 parent 929eb2c commit 12bf92d

File tree

14 files changed

+201
-25
lines changed

14 files changed

+201
-25
lines changed

bun.lock

Lines changed: 94 additions & 10 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"build": "bun run --cwd packages/react-netlify-forms build",
99
"dev": "bun run --cwd packages/docs dev",
1010
"lint": "biome check",
11-
"format": "biome format --write .",
11+
"format": "biome check --write .",
1212
"docs:dev": "bun run --cwd packages/docs dev",
1313
"docs:build": "bun run --cwd packages/docs build",
1414
"docs:preview": "bun run --cwd packages/docs preview"

packages/docs/astro.config.mjs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// @ts-check
2-
import { defineConfig } from 'astro/config'
3-
import starlight from '@astrojs/starlight'
2+
43
import mdx from '@astrojs/mdx'
4+
import react from '@astrojs/react'
5+
import starlight from '@astrojs/starlight'
6+
import { defineConfig } from 'astro/config'
57
import starlightThemeRapide from 'starlight-theme-rapide'
68

79
// https://astro.build/config
@@ -16,6 +18,7 @@ export default defineConfig({
1618
src: './src/assets/logo.png',
1719
alt: 'react-netlify-forms'
1820
},
21+
favicon: '/favicon.png',
1922
social: [
2023
{
2124
icon: 'github',
@@ -28,11 +31,13 @@ export default defineConfig({
2831
label: 'Examples',
2932
autogenerate: { directory: 'examples' }
3033
},
34+
{ slug: 'playground' },
3135
{ slug: 'reference' },
3236
{ slug: 'license' }
3337
]
3438
}),
35-
mdx()
39+
mdx(),
40+
react()
3641
],
3742
site: 'https://pyrax.github.io/react-netlify-forms',
3843
base: '/react-netlify-forms'

packages/docs/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212
},
1313
"dependencies": {
1414
"@astrojs/mdx": "^4.3.0",
15+
"@astrojs/react": "^4.3.0",
1516
"@astrojs/starlight": "^0.34.3",
1617
"@types/react": "^19.1.6",
1718
"@types/react-dom": "^19.1.6",
1819
"astro": "^5.6.1",
1920
"react": "^19.1.0",
2021
"react-dom": "^19.1.0",
22+
"react-live": "^4.1.8",
2123
"react-netlify-forms": "workspace:*",
2224
"sharp": "^0.32.5",
2325
"starlight-theme-rapide": "^0.5.1"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { LiveEditor, LiveError, LivePreview, LiveProvider } from 'react-live'
2+
import * as components from 'react-netlify-forms'
3+
4+
interface LiveCodeProps {
5+
code: string
6+
}
7+
8+
export default function LiveCode({ code }: LiveCodeProps) {
9+
return (
10+
<LiveProvider code={code.trim()} scope={{ ...components }}>
11+
<LiveEditor />
12+
<LivePreview />
13+
<LiveError />
14+
</LiveProvider>
15+
)
16+
}

packages/docs/src/content/docs/examples/contact-form.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Contact Form Example
2+
title: Contact Form
33
---
44

55
## Get started

packages/docs/src/content/docs/examples/formik.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Formik Newsletter Example
2+
title: Formik Newsletter
33
---
44

55
In this example we will create a simple newsletter signup form with Formik. It only includes an email field which is validated client-side (note: client-side validation is not safe, thus you might see data other than emails in Netlify).

packages/docs/src/content/docs/examples/react-hook-form.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: react-hook-form Example
2+
title: react-hook-form
33
---
44

55
In this example we will create a simple newsletter signup form with react-hook-form. It only includes an email field which is validated client-side (note: client-side validation is not safe, thus you might see data other than emails in Netlify).

packages/docs/src/content/docs/examples/recaptcha.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: reCAPTCHA Example
2+
title: reCAPTCHA
33
description: Contact form with invisible reCAPTCHA
44
---
55

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
title: Playground
3+
sidebar:
4+
badge: Live
5+
---
6+
7+
import LiveCode from '../../components/LiveCode'
8+
9+
This is a playground for the react-netlify-forms library. Try to edit the code below and see the changes in the preview.
10+
11+
<LiveCode client:idle code={`
12+
<NetlifyForm
13+
name='Contact'
14+
action='/thanks'
15+
honeypotName='bot-field'
16+
onSuccess={(response, context) => {
17+
console.log('Successfully sent form data to Netlify Server')
18+
context.formRef.current.reset()
19+
}}
20+
>
21+
{({ handleChange, success, error }) => (
22+
<>
23+
<Honeypot />
24+
{success && (
25+
<p>
26+
Thanks for contacting us!
27+
</p>
28+
)}
29+
{error && (
30+
<p>
31+
Sorry, we could not reach servers. Because it only works on Netlify,
32+
our GitHub demo does not provide a response.
33+
</p>
34+
)}
35+
<div>
36+
<label htmlFor='name'>
37+
Name:
38+
</label>
39+
<input
40+
type='text'
41+
name='name'
42+
id='name'
43+
onChange={handleChange}
44+
/>
45+
</div>
46+
<div>
47+
<label htmlFor='message'>
48+
Message:
49+
</label>
50+
<textarea
51+
type='text'
52+
name='message'
53+
id='message'
54+
rows='4'
55+
onChange={handleChange}
56+
/>
57+
</div>
58+
<div>
59+
<button type='submit'>
60+
Submit
61+
</button>
62+
<button type='reset'>
63+
Reset
64+
</button>
65+
</div>
66+
</>
67+
)}
68+
</NetlifyForm>
69+
`} />

0 commit comments

Comments
 (0)