Skip to content

Commit

Permalink
Add Documentation for Next.JS based projects
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianGode committed Feb 13, 2024
1 parent d66d22f commit 17868a1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ please open an issue!
| -------------------------------- | -------------------------------------- | --------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| Vanilla JavaScript(No Framework) | [packages/vanilla](./packages/vanilla) | [![0.1.0](https://img.shields.io/badge/TypeScript_docs-master-2b7489)](https://mcaptcha.github.io/glue/vanilla) | [![NPM](https://img.shields.io/npm/v/@mcaptcha/vanilla-glue.svg)](https://www.npmjs.com/package/@mcaptcha/vanilla-glue) |
| React JS | [packages/react](./packages/react) | [![0.1.0](https://img.shields.io/badge/TypeScript_docs-master-2b7489)](https://mcaptcha.github.io/glue/react/) | [![NPM](https://img.shields.io/npm/v/@mcaptcha/react-glue.svg)](https://www.npmjs.com/package/@mcaptcha/react-glue) |
| Next.JS | [packages/react](./packages/react) | [![0.1.0](https://img.shields.io/badge/TypeScript_docs-master-2b7489)](https://mcaptcha.github.io/glue/react/) | [![NPM](https://img.shields.io/npm/v/@mcaptcha/react-glue.svg)](https://www.npmjs.com/package/@mcaptcha/react-glue) |
| Svelte JS | [packages/svelte](./packages/svelte) | [![0.1.0](https://img.shields.io/badge/TypeScript_docs-master-2b7489)](https://mcaptcha.github.io/glue/svelte/) | [![NPM](https://img.shields.io/npm/v/@mcaptcha/svelte-glue.svg)](https://www.npmjs.com/package/@mcaptcha/svelte-glue) |

## Core library
Expand Down
23 changes: 21 additions & 2 deletions packages/react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ npm install --save @mcaptcha/react-glue

## Usage

For React based projects:
```tsx
import React, { Component, WidgetConfig } from 'react'

import MyComponent from 'react-glue'
import MCaptchaWidget from 'react-glue'
import 'react-glue/dist/index.css'

class Example extends Component {
Expand All @@ -33,7 +34,25 @@ class Example extends Component {
}
const config: WidgetConfig = { siteKey }

return <MyComponent {...config} />
return <MCaptchaWidget {...config} />
}
}
```

For Next.JS based projects:
```jsx
import React from 'react';
import { MCaptchaWidget } from '@mcaptcha/react-glue';

function Captcha() {
const config = {
widgetLink: new URL('https://yourdomain.tld/widget/?sitekey=yourstiekey')
};

return (
<MCaptchaWidget {...config} />
);
}

export default Captcha;
```

0 comments on commit 17868a1

Please sign in to comment.