aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/icons.tsx
blob: 402b6221b3143dd498e1c38ea82a81841b47f2d6 (plain) (blame)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
 * SPDX-FileCopyrightText: 2023 Kristóf Marussy
 *
 * SPDX-License-Identifier: MIT
 */

import { useId } from 'react';
import { siGithub, siGooglescholar, siLinkedin, siOrcid } from 'simple-icons';

import fediverse from './icons/fediverse';

export function Icon({ path, alt }: { path: string; alt: string }) {
  const titleId = useId();

  return (
    <>
      <svg
        version="1.1"
        xmlns="http://www.w3.org/2000/svg"
        role="img"
        aria-labelledby={titleId}
        viewBox="0 0 24 24"
        width="24"
        height="24"
      >
        <path fill="currentColor" d={path} />
      </svg>
      <span className="sr-only" id={titleId}>
        {alt}
      </span>
    </>
  );
}

export function SimpleIcon({
  icon: { path, title },
}: {
  icon: {
    path: string;
    title: string;
  };
}) {
  return <Icon path={path} alt={title} />;
}

export const FediverseIcon = () => <SimpleIcon icon={fediverse} />;

export const GithubIcon = () => <SimpleIcon icon={siGithub} />;

export const GoogleScholarIcon = () => <SimpleIcon icon={siGooglescholar} />;

export const LinkedInIcon = () => <SimpleIcon icon={siLinkedin} />;

export const OrcidIcon = () => <SimpleIcon icon={siOrcid} />;