aboutsummaryrefslogtreecommitdiff
path: root/lume/src/_components/Figure.tsx
blob: ad8d8029ccca7c698adc168b737f067e7c2eedcd (plain)
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
export interface FigureProps {
  className?: string;
  path: string;
  desc?: string;
  alt?: string;
}

export default function Figure(
  { className, path, alt, desc = alt }: FigureProps,
) {
  return (
    <figure className={`max-w-3xl mx-auto ${className}`}>
      <a
        href={`https://cdn.xeiaso.net/file/christine-static/${path}`}
        target="_blank"
      >
        <img
          src={`https://cdn.xeiaso.net/file/christine-static/${path}`}
          alt={desc}
        />
      </a>
      {desc && <figcaption>{desc}</figcaption>}
    </figure>
  );
}