aboutsummaryrefslogtreecommitdiff
path: root/lume/src/_components/XeblogPicture.tsx
blob: 857ce9fc437d21bd41be5a0eed6965b1629901ee (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
export interface XeblogPicture {
  path: string;
  desc?: string;
}

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