All files / src/components/pricing/SubscriptionTier SubscriptionTier.tsx

0% Statements 0/3
0% Branches 0/2
0% Functions 0/2
0% Lines 0/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80                                                                                                                                                               
import { FC, CSSProperties } from "react";
import Logo from "../../img/Logo/Logo";
import "./SubscriptionTier.css";
import { getPrice } from "@/util/price";
 
export interface SubscriptionTierProps {
  product_id: string;
  name: string;
  features: string[];
  allowances: {
    projects: number;
    users: number;
    agents: number;
    tasks: number;
  };
  currency: string;
  price: number;
  interval: string;
  css?: CSSProperties;
}
 
const SubscriptionTier: FC<SubscriptionTierProps> = (props) => {
  return (
    <section style={props.css} className="subscription-tier hover:shadow-2xl">
      <div className="flex flex-col items-center justify-center gap-2 p-2">
        <Logo />
        <div className="flex flex-col gap-8">
          <h3>{props.name}</h3>
          <h5>
            {getPrice(props.currency, props.price)} / {props.interval}
          </h5>
          {props.features.length > 0 && (
            <div>
              <p>Features:</p>
              {
                <ul>
                  {props.features.map((ftr) => {
                    return <li>{ftr}</li>;
                  })}
                </ul>
              }
            </div>
          )}
          <div>
            <ul>
              <li>
                <span className="font-bold">Users:</span>
                {props.allowances.users}
              </li>
              <li>
                <span className="font-bold">Projects:</span>
                {props.allowances.projects}
              </li>
              <li>
                <span className="font-bold">Agents:</span>
                {props.allowances.agents}
              </li>
              <li>
                <span className="font-bold">Tasks:</span>
                {props.allowances.tasks}
              </li>
            </ul>
          </div>
        </div>
        <div className="mb-8" />
        <form className="bottom-2">
          {/* action="/create-checkout-session" method="POST" */}
          {/* Add a hidden field with the lookup_key of your Price */}
          <input type="hidden" name="lookup_key" value="{{PRICE_LOOKUP_KEY}}" />
          <button id="checkout-and-portal-button" type="submit">
            Checkout
          </button>
        </form>
      </div>
    </section>
  );
};
 
export default SubscriptionTier;