Skip to content

Commit

Permalink
docs: Add documentation for the @poap-xyz/frames package (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
reobin authored Apr 3, 2024
1 parent 01bb827 commit 196df60
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 1 deletion.
8 changes: 8 additions & 0 deletions docs/pages/packages/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"poaps": "POAPs",
"drops": "Drops",
"moments": "Moments",
"providers": "Providers",
"frames": "Frames",
"utils": "Utils"
}
90 changes: 90 additions & 0 deletions docs/pages/packages/frames.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# @poap-xyz/frames

[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)

@poap-xyz/frames is a package to ease the use of [Farcaster Frames](https://docs.farcaster.xyz/learn/what-is-farcaster/frames).

## Features

- Get the list of meta tags to add to an HTML page head
- Build and render the HTML page representing the frame

## Installation

### NPM

```bash
npm install @poap-xyz/frames
```

### Yarn

```bash
yarn add @poap-xyz/frames
```

## Usage

### Get the list of meta tags

```typescript
// pages/index.tsx
import { NextSeo } from 'next-seo';
import { Frame, FrameAspectRatio } from '@poap-xyz/frames';

export default function Component() {
const frame = new Frame({
title: 'Hello Frames!',
image: '<image_url>',
aspectRatio: FrameAspectRatio.SQUARE,
});

return (
<>
<NextSeo
title="Hello Frames!"
description="page description"
openGraph={{ images: [{ url: '<image_url>' }] }}
additionalMetaTags={frame.toMetaTags()}
/>
<div>page content...</div>
</>
)
}
```

### Build and render the HTML page representing the frame

```typescript
// pages/api/frame.ts
import { NextApiRequest, NextApiResponse } from 'next';
import { Frame, FrameAspectRatio } from '@poap-xyz/frames';

export default async function handler(
req: NextApiRequest,
res: NextApiResponse,
) {
const frame = new Frame({
title: 'Hello Frames!',
image: '<image_url>',
aspectRatio: FrameAspectRatio.SQUARE,
});
return res.status(200).send(frame.render());
}
```

## Documentation

For more detailed documentation on POAP topics, please visit [this link](https://documentation.poap.tech/docs).

## Examples

For example scripts and usage, please check the [examples](https://github.com/poap-xyz/poap.js/tree/main/examples).

## Contributing

We welcome contributions! Please see the `CONTRIBUTING.md` file for guidelines.

## License

@poap-xyz/frames is released under the [MIT License](https://opensource.org/licenses/MIT).
2 changes: 1 addition & 1 deletion packages/frames/src/Frame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class Frame {
* Generates the meta tags used for the frame.
*
* @example
* const frame = useMemo(() => new Frame({ ... });
* const frame = new Frame({ ... });
* return (
* <>
* <NextSeo
Expand Down

0 comments on commit 196df60

Please sign in to comment.