-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/search-drops
- Loading branch information
Showing
4 changed files
with
102 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters