aboutsummaryrefslogtreecommitdiff
path: root/users/ryan/modules/simple-bar/simple-bar-source/lib/components/side-icon.jsx
blob: 893241d1c5f07975444832e3f7c8c186e0b252ca (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
import * as Uebersicht from "uebersicht";
import * as Icons from "./icons/icons.jsx";
import { SuspenseIcon } from "./icons/icon.jsx";
import { useSimpleBarContext } from "./simple-bar-context.jsx";

const { React } = Uebersicht;

export { sideIconStyles as styles } from "../../lib/styles/components/side-icon";

/**
 * Component to render the side icon based on the settings.
 *
 * @returns {JSX.Element|null} The side icon component or null if sideDecoration is disabled.
 */
export function Component() {
  // Using context to get settings
  const { settings } = useSimpleBarContext();
  // Destructuring sideDecoration from global settings
  const { sideDecoration } = settings.global;

  // If sideDecoration is disabled, return null
  if (!sideDecoration) return null;

  // Render the side icon component
  return (
    <div className="side-icon">
      <SuspenseIcon>
        <Icons.Apple className="side-icon__svg" />
      </SuspenseIcon>
    </div>
  );
}