Skip to content
Docs
React Components

Installation

To install the package, you can use either npm or yarn:

npm install @infrhq/react
yarn add @infrhq/react

Usage

Card

Import the InfrAdCard component from @infrhq/react in your application:

import { InfrAdCard } from '@infrhq/react';

You can then use it in your components like this:

<InfrAdCard publicKey={publicKey} backdrop={backdrop} systemMessage={systemMessage} backgroundColor={backgroundColor} />

Where:

  • publicKey - Your Infr API's public key.
  • backdrop - The backdrop for the ad.
  • systemMessage - The system message for the ad.
  • backgroundColor - The background color for the ad card. Can be "light", "dark" or any custom color code.

Note: All of the above properties are optional, but you'd typically want to provide at least the publicKey for your Infr API.

Here's a functional example you can use directly:

 
function App() {
  return (
    <div>
      <InfrAdCard publicKey="test" backdrop="Travel, vacations, hotels"/>
    </div>
  );
}

In this example, an ad card from Infr is displayed with a light background color.

Development

For developing this package:

  • Clone the repository
  • Install the dependencies with npm install
  • Use npm run build to compile the TypeScript code

Bugs

For any bugs, please raise an issue in the GitHub repository.

License

This package is released under the MIT license. See LICENSE for more details.

Contributing

We welcome contributions! Please see our CONTRIBUTING guide for more details.

Questions

For any questions or suggestions, please use the GitHub issues page.

Links