aboutsummaryrefslogtreecommitdiff
path: root/lume/src/_components/XeblogPicture.tsx
blob: e7a95d467a26900cbfcc6f955e25dbd2638dc979 (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
26
27
28
29
30
31
32
33
34
35
export interface XeblogPicture {
  path: string;
  desc?: string;
  className?: string;
}

export default function XeblogPicture({
  path,
  desc,
  className,
}: XeblogPicture) {
  return (
    <figure className={`max-w-3xl mx-auto not-prose w-full ${className}`}>
      <a href={`https://files.xeiaso.net/${path}.jpg`}>
        <picture>
          <source
            type="image/avif"
            srcset={`https://files.xeiaso.net/${path}.avif`}
          />
          <source
            type="image/webp"
            srcset={`https://files.xeiaso.net/${path}.webp`}
          />
          <img
            alt={desc}
            className={className}
            loading="lazy"
            src={`https://files.xeiaso.net/${path}.jpg`}
          />
        </picture>
      </a>
      {desc && <figcaption>{desc}</figcaption>}
    </figure>
  );
}