import Container from "@/components/Container/Container";
import Section from "@/components/Section/Section";
import React from "react";
import Image from "next/image";
import { getCachedMedia } from "@/services/wp";

const ClientQuote = async (props: any) => {
  let image: { source_url?: string } | undefined = undefined;

  if (props.image) {
    image = await getCachedMedia(props.image);
  }


  return (
    <Container id={props.anchor}>
      <Section gridArea="thin" className={"overflow-visible"}>
        <div>
          {typeof image !== "undefined" && (
            <Image
              className={"rounded-xl xl:block hidden absolute -left-[120px]"}
              // @ts-ignore
              src={image?.source_url}
              alt={"test"}
              width={"100"}
              height={"100"}
            />
          )}
          <p>
            <strong>&quot;</strong>
            {props.content}
            <strong>&quot;</strong>
          </p>
        </div>
        <div className={"flex justify-start items-center"}>
          {typeof image !== "undefined" && (
            <Image
              className={"rounded-xl block mr-xs lg:mr-0 xl:hidden"}
              // @ts-ignore
              src={image?.source_url}
              alt={props.name}
              width={"100"}
              height={"100"}
            />
          )}
          <div className={"flex flex-col items-start justify-items-start"}>
            <p className={"h3 m-none"}>
              {props.name}
              {props.title && <span>, {props.title}</span>}
            </p>
            <p className={"m-none"}>{props.company}</p>
          </div>
        </div>
      </Section>
    </Container>
  );
};

export default ClientQuote;
