users/ryan/modules/simple-bar/simple-bar-source/lib/components/side-icon.jsx

cd1edb8102b069072cafb8b7e399ab252472b995 · 968 B · 32 lines raw

1 import * as Uebersicht from "uebersicht";
2 import * as Icons from "./icons/icons.jsx";
3 import { SuspenseIcon } from "./icons/icon.jsx";
4 import { useSimpleBarContext } from "./simple-bar-context.jsx";
5
6 const { React } = Uebersicht;
7
8 export { sideIconStyles as styles } from "../../lib/styles/components/side-icon";
9
10 /**
11 * Component to render the side icon based on the settings.
12 *
13 * @returns {JSX.Element|null} The side icon component or null if sideDecoration is disabled.
14 */
15 export function Component() {
16 // Using context to get settings
17 const { settings } = useSimpleBarContext();
18 // Destructuring sideDecoration from global settings
19 const { sideDecoration } = settings.global;
20
21 // If sideDecoration is disabled, return null
22 if (!sideDecoration) return null;
23
24 // Render the side icon component
25 return (
26 <div className="side-icon">
27 <SuspenseIcon>
28 <Icons.Apple className="side-icon__svg" />
29 </SuspenseIcon>
30 </div>
31 );
32 }