diff --git a/src/components/ClassTable.tsx b/src/components/ClassTable.tsx
index 12fce63..5402dca 100644
--- a/src/components/ClassTable.tsx
+++ b/src/components/ClassTable.tsx
@@ -7,8 +7,7 @@ import React, { useEffect, useMemo, useRef, useState } from "react";
import { LuPlus, LuMinus, LuSearch } from "react-icons/lu";
import { InputGroup } from "./ui/input-group";
-import { Tooltip } from "./ui/tooltip";
-import { Button } from "./ui/button";
+import { Button, LabelledButton } from "./ui/button";
import { useColorMode } from "./ui/color-mode";
import { Class, DARK_IMAGES, Flags, getFlagImg } from "../lib/class";
@@ -222,34 +221,33 @@ function ClassFlags(props: {
{group.map(([flag, label, image]) => {
const checked = flags.get(flag);
- const content = (
+ return image ? (
+ onChange(flag, !checked)}
+ title={label}
+ variant={checked ? "solid" : "outline"}
+ portalled
+ >
+
+
+ ) : (
);
- return image ? (
-
- {content}
-
- ) : (
- content
- );
})}
);
diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsx
index d8e37bc..ef336e5 100644
--- a/src/components/ui/button.tsx
+++ b/src/components/ui/button.tsx
@@ -4,8 +4,10 @@ import {
Button as ChakraButton,
Span,
Spinner,
+ Tooltip as ChakraTooltip,
} from "@chakra-ui/react";
import * as React from "react";
+import { Tooltip } from "./tooltip";
interface ButtonLoadingProps {
loading?: boolean;
@@ -45,3 +47,27 @@ export const Button = React.forwardRef(
);
},
);
+
+export interface LabelledButtonProps extends ButtonProps {
+ showArrow?: boolean;
+ portalled?: boolean;
+ portalRef?: React.RefObject;
+ titleProps?: ChakraTooltip.ContentProps;
+ disabled?: boolean;
+}
+
+export const LabelledButton = (props: LabelledButtonProps) => {
+ const { showArrow, title, titleProps, portalled, disabled, ...rest } = props;
+ if (!title) return ;
+ return (
+
+
+
+ );
+};