summaryrefslogtreecommitdiff
path: root/frontend/src/components/logviewer/LoggedPlugin.tsx
blob: af7564e2d37fcf50a51b6bdf6d9e63ef58c86a27 (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
import { Focusable } from "decky-frontend-lib";
import { VFC, useState } from "react";
import { FaArrowDown, FaArrowUp } from "react-icons/fa";
import LogList from "./LogList";

interface LoggedPluginProps {
  plugin: string;
}

const focusableStyle = {
  background: "rgba(255,255,255,.15)",
  borderRadius: "var(--round-radius-size)",
  padding: "10px 24px",
  marginBottom: "0.5rem",
};

const LoggedPlugin: VFC<LoggedPluginProps> = ({ plugin }) => {
  const [isOpen, setOpen] = useState<boolean>(false);

  return (
    <div style={focusableStyle}>
      <Focusable onOKButton={() => setOpen(!isOpen)}>
        <div style={{ display: "flex", justifyContent: "space-between" }}>
          <div style={{ flexGrow: 1, textAlign: "left" }}>{plugin}</div>
          <div style={{ textAlign: "right" }}>
            {isOpen ? <FaArrowUp /> : <FaArrowDown />}
          </div>
        </div>
      </Focusable>
      {isOpen && <LogList plugin={plugin} />}
    </div>
  );
};

export default LoggedPlugin;