import { withSubComponents } from "@components/helpers/withSubComponents.ts";
import Image from "@components/Image.tsx";
import { IconExternalLink } from "@components/icons.tsx";
import { type ComponentChildren, createContext } from "preact";
import { IconArrowNarrowLeft } from "@components/icons.tsx";
import { IconEdit } from "@components/icons.tsx";
import { useContext } from "preact/hooks";
const HeroContext = createContext<{ image?: string; thumbnail?: string }>({
  image: undefined,
  thumbnail: undefined,
});
function Wrapper(
  { children, image, thumbnail }: {
    children: ComponentChildren;
    image?: string;
    thumbnail?: string;
  },
) {
  return (
    
      
        {image &&
          (
            
          )}
        {children}
      
    
  );
}
function Title(
  { children, link }: { children: ComponentChildren; link?: string },
) {
  const ctx = useContext(HeroContext);
  const OuterTag = link ? "a" : "div";
  return (
    
      
        {children}
        {link &&
          }
      
    
  );
}
function BackLink({ href }: { href: string }) {
  return (
    
       Back
    
  );
}
function EditLink({ href }: { href: string }) {
  const ctx = useContext(HeroContext);
  return (
    
      
    
  );
}
function Header({ children }: { children: ComponentChildren }) {
  return (
    
      {children}
    
  );
}
function Subline(
  { entries, children }: {
    children?: ComponentChildren;
    entries: (string | { href: string; title: string })[];
  },
) {
  const ctx = useContext(HeroContext);
  return (
    
      {children}
      {entries.filter((s) =>
        s && (typeof s === "string" ? s?.length > 1 : true)
      ).map((s) => {
        if (typeof s === "string") {
          return 
{s};
        } else {
          return 
{s.title};
        }
      })}
    
      {children}
    
  );
}
export default withSubComponents(Wrapper, {
  EditLink,
  BackLink,
  Footer,
  Subline,
  Header,
  Title,
});