aboutsummaryrefslogtreecommitdiff
path: root/users/ryan/modules/simple-bar/simple-bar-source/lib/components/icons/icon.jsx
blob: c46f60c3f0f53e4f7a7e7e9e4ca83d920966c8a8 (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
36
37
38
39
40
import * as Uebersicht from "uebersicht";

const { React } = Uebersicht;

/**
 * Icon component renders an SVG element.
 *
 * @param {Object} props - The properties object.
 * @param {number} [props.width=24] - The width of the SVG.
 * @param {number} [props.height=24] - The height of the SVG.
 * @param {React.ReactNode} props.children - The children elements to be rendered inside the SVG.
 * @returns {JSX.Element} The SVG element.
 */
export default function Icon({ width = 24, height = 24, children, ...props }) {
  return (
    <svg
      viewBox={`0 0 ${width} ${height}`}
      width={width}
      height={height}
      {...props}
    >
      {children}
    </svg>
  );
}

/**
 * SuspenseIcon component renders its children within a React.Suspense component.
 *
 * @param {Object} props - The properties object.
 * @param {React.ReactNode} props.children - The children elements to be rendered inside the Suspense component.
 * @returns {JSX.Element} The Suspense component with a fallback SVG loader.
 */
export function SuspenseIcon({ children }) {
  return (
    <React.Suspense fallback={<svg className="simple-bar-icon-loader" />}>
      {children}
    </React.Suspense>
  );
}