diff --git a/src/components/header/cpu.module.css b/src/components/header/cpu.module.css new file mode 100644 index 0000000..82d9fb4 --- /dev/null +++ b/src/components/header/cpu.module.css @@ -0,0 +1,36 @@ +.cpuRoot { + border-radius: var(--mantine-radius-sm); + background-color: var(--mantine-color-dark-3); + overflow: hidden; + position: relative; + height: 20px; + width: 40px; +} + +.cpuBar { + background-color: var(--mantine-primary-color-filled); + border-bottom-left-radius: var(--mantine-radius-sm); + border-top-left-radius: var(--mantine-radius-sm); + height: 100%; + left: 0; + top: 0; + position: absolute; + width: 100%; + z-index: 2; +} + +.cpuLabel { + color: var(--mantine-primary-color-contrast); + display: flex; + align-items: center; + justify-content: center; + font-size: var(--mantine-font-size-xs); + font-weight: bold; + left: 0; + padding: 0 var(--mantine-spacing-xs); + position: absolute; + top: 0; + width: 100%; + height: 100%; + z-index: 3; +} diff --git a/src/components/header/cpu.tsx b/src/components/header/cpu.tsx new file mode 100644 index 0000000..7687950 --- /dev/null +++ b/src/components/header/cpu.tsx @@ -0,0 +1,19 @@ +import { forwardRef, FunctionComponent, memo } from "react"; +import classes from "./cpu.module.css"; + +export type CPUStatusProps = { + load: number; +}; + +export const CPUStatus: FunctionComponent = memo(forwardRef( + function WrappedCPUStatusComponent({ load }, ref) { + return ( +
+
+ +
+ ); + } +)); diff --git a/src/components/header/index.tsx b/src/components/header/index.tsx index dd2b1c6..36a0ecd 100644 --- a/src/components/header/index.tsx +++ b/src/components/header/index.tsx @@ -1,5 +1,5 @@ import React, { FunctionComponent, memo, useCallback } from "react"; -import { ActionIcon, AppShell, Burger, Group, Progress, Tooltip } from "@mantine/core"; +import { ActionIcon, AppShell, Burger, Group, Tooltip } from "@mantine/core"; import classes from "./header.module.css"; import { useThemeColorScheme } from "../../hooks/useTheme"; import { useAppDispatch, useAppSelector } from "../../hooks/useAppDispatch"; @@ -12,6 +12,7 @@ import { RunnerInfoKey } from "../../models/runnerInfo"; import { AppStatus } from "../../lib/constants"; import { IconElement } from "../elements/icon"; import { mdiMetronome, mdiSatelliteUplink } from "@mdi/js"; +import { CPUStatus } from "./cpu"; export type HeaderProps = { navOpen: boolean; @@ -59,8 +60,8 @@ export const Header: FunctionComponent = memo(function WrappedHeade - - + +