diff --git a/dev/src/App.tsx b/dev/src/App.tsx
index 010a1df0..60aae4fe 100644
--- a/dev/src/App.tsx
+++ b/dev/src/App.tsx
@@ -1,5 +1,18 @@
import * as React from "react";
-import { Box, Container, Stack, Typography } from "@mui/material";
+import {
+ Box,
+ Chip,
+ Container,
+ Paper,
+ Stack,
+ Typography,
+ Table,
+ TableBody,
+ TableCell,
+ TableContainer,
+ TableHead,
+ TableRow,
+} from "@mui/material";
import {
BrowserRouter,
Link as RouterLink,
@@ -8,6 +21,8 @@ import {
} from "react-router-dom";
import { ThemeProvider, DiamondDSTheme } from "../../src/index";
+import type { Theme } from "@mui/material/styles";
+
import {
Navbar,
NavLinks,
@@ -17,6 +32,107 @@ import { ColourSchemeButton } from "../../src/components/controls/ColourSchemeBu
import { Breadcrumbs } from "../../src/components/navigation/Breadcrumbs";
import { Bar } from "../../src/components/controls/Bar";
+/* TABLE */
+
+export const SimpleMuiTableExample = () => (
+
+
+
+
+ Experiment ID
+ Scientist
+ Beamline
+ Status
+ Energy
+
+
+
+
+ {data.map((row) => (
+
+ {row.id}
+ {row.scientist}
+ {row.beamline}
+
+
+
+ {row.energy.toFixed(1)} keV
+
+ ))}
+
+
+
+);
+
+type Experiment = {
+ id: string;
+ scientist: string;
+ beamline: string;
+ status: ExperimentStatus;
+ energy: number;
+};
+
+const data: Experiment[] = [
+ {
+ id: "EXP-1001",
+ scientist: "Ada Lovelace",
+ beamline: "I24",
+ status: "Running",
+ energy: 12.4,
+ },
+ {
+ id: "EXP-1002",
+ scientist: "Alan Turing",
+ beamline: "I03",
+ status: "Queued",
+ energy: 9.8,
+ },
+ {
+ id: "EXP-1003",
+ scientist: "Grace Hopper",
+ beamline: "B24",
+ status: "Completed",
+ energy: 7.2,
+ },
+ {
+ id: "EXP-1004",
+ scientist: "Dorothy Vaughan",
+ beamline: "I24",
+ status: "Failed",
+ energy: 13.1,
+ },
+ {
+ id: "EXP-1005",
+ scientist: "Katherine Johnson",
+ beamline: "DIAD",
+ status: "Paused",
+ energy: 15.7,
+ },
+];
+
+type ExperimentStatus =
+ | "Running"
+ | "Queued"
+ | "Completed"
+ | "Failed"
+ | "Paused";
+
+const statusColour: Record<
+ ExperimentStatus,
+ "success" | "info" | "default" | "error" | "warning"
+> = {
+ Running: "success",
+ Queued: "info",
+ Completed: "default",
+ Failed: "error",
+ Paused: "warning",
+};
+
const App = () => {
return (
@@ -113,58 +229,213 @@ const ComponentsPage = () => {
+
+
+ Table - Simple Table
+
+
+
);
};
+type IntentGroup = {
+ key: string;
+ label: string;
+ getPalette: (theme: Theme) => Record | undefined;
+};
+
+const intentGroups: IntentGroup[] = [
+ {
+ key: "primary",
+ label: "Primary",
+ getPalette: (theme) => theme.vars?.palette.primary ?? theme.palette.primary,
+ },
+ {
+ key: "secondary",
+ label: "Secondary",
+ getPalette: (theme) =>
+ theme.vars?.palette.secondary ?? theme.palette.secondary,
+ },
+ {
+ key: "tertiary",
+ label: "Tertiary",
+ getPalette: (theme) =>
+ theme.vars?.palette.tertiary ?? theme.palette.tertiary,
+ },
+ {
+ key: "brand",
+ label: "Brand",
+ getPalette: (theme) => theme.vars?.palette.brand ?? theme.palette.brand,
+ },
+ {
+ key: "error",
+ label: "Danger",
+ getPalette: (theme) => theme.vars?.palette.error ?? theme.palette.error,
+ },
+ {
+ key: "warning",
+ label: "Warning",
+ getPalette: (theme) => theme.vars?.palette.warning ?? theme.palette.warning,
+ },
+ {
+ key: "success",
+ label: "Success",
+ getPalette: (theme) => theme.vars?.palette.success ?? theme.palette.success,
+ },
+ {
+ key: "info",
+ label: "Info",
+ getPalette: (theme) => theme.vars?.palette.info ?? theme.palette.info,
+ },
+];
+
+const intentRows = [
+ { bg: "main", fg: "contrastText", label: "" },
+ { bg: "dark", fg: "contrastText", label: "Emphasis" },
+ { bg: "light", fg: "contrastText", label: "Accent" },
+ { bg: "container", fg: "onContainer", label: "Container" },
+ { bg: "onContainer", fg: "container", label: "On Container" },
+ { bg: "solid", fg: "onSolid", label: "Solid" },
+ { bg: "onSolid", fg: "solid", label: "On Solid" },
+ { bg: "fixed", fg: "onFixed", label: "Fixed" },
+ { bg: "fixedDim", fg: "onFixed", label: "Fixed Dim" },
+ { bg: "onFixed", fg: "fixed", label: "On Fixed" },
+];
+
+const getPaletteValue = (theme: Theme, path: string): string | undefined => {
+ const value = path.split(".").reduce((obj, key) => {
+ if (obj && typeof obj === "object") {
+ return (obj as Record)[key];
+ }
+ return undefined;
+ }, theme.palette);
+
+ return typeof value === "string" ? value : undefined;
+};
+
+type ColourRowProps = {
+ label: string;
+ background: string;
+ foreground: string;
+};
+
+const ColourRow = ({ label, background, foreground }: ColourRowProps) => (
+ ({
+ px: 1.25,
+ py: 1,
+ minHeight: 40,
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "space-between",
+ backgroundColor: getPaletteValue(theme, background),
+ color: getPaletteValue(theme, foreground),
+ })}
+ >
+ {label}
+
+
+ {background}
+
+
+);
+
const ThemePage = () => {
return (
Theme
-
- ({
- p: 2,
- minWidth: 180,
- borderRadius: 2,
- backgroundColor: theme.palette.surface.default,
- color: theme.palette.text.primary,
- border: `1px solid ${theme.palette.border.subtle}`,
- })}
- >
- surface.default
- border.subtle
-
-
- ({
- p: 2,
- minWidth: 180,
- borderRadius: 2,
- backgroundColor: theme.palette.surface.strong,
- color: theme.palette.text.primary,
- border: `1px solid ${theme.palette.border.subtle}`,
- })}
- >
- surface.strong
- text.primary
-
-
- ({
- p: 2,
- minWidth: 180,
- borderRadius: 2,
- backgroundColor: theme.palette.primary.main,
- color: theme.palette.primary.contrastText,
- border: `1px solid ${theme.palette.primary.main}`,
- })}
- >
- primary.main
- primary.contrastText
-
-
+ ({
+ p: 2,
+ backgroundColor: theme.palette.surface.subtle,
+ })}
+ >
+
+
+ {intentGroups.map((group) => (
+
+ {intentRows.map((row) => (
+ {
+ const palette = group.getPalette(theme);
+
+ if (!palette?.[row.bg] || !palette?.[row.fg]) {
+ return { display: "none" };
+ }
+
+ return {
+ px: 1.25,
+ py: 1,
+ minHeight: 40,
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "space-between",
+ gap: 2,
+ backgroundColor: palette[row.bg],
+ color: palette[row.fg],
+ };
+ }}
+ >
+
+ {row.label ? `${group.label} ${row.label}` : group.label}
+
+
+
+ {row.bg}
+
+
+ ))}
+
+ ))}
+
+
+ Neutral colours
+
+
+
+
+
+
+
+
+
+
+
+ {/* rest of surface / border sections can stay as before */}
+
+
);
};