+
}
@@ -321,20 +336,3 @@ const TableLoader = ({
const cantBeChecked = (workspace: Workspace) => {
return ["deleting", "pending"].includes(workspace.latest_build.status);
};
-
-const useStyles = makeStyles((theme) => ({
- withImage: {
- paddingBottom: 0,
- },
- emptyImage: {
- maxWidth: "50%",
- height: theme.spacing(34),
- overflow: "hidden",
- marginTop: theme.spacing(6),
- opacity: 0.85,
-
- "& img": {
- maxWidth: "100%",
- },
- },
-}));
diff --git a/site/src/utils/colors.ts b/site/src/utils/colors.ts
index 2f0b3708abcaf..f4d795bc05400 100644
--- a/site/src/utils/colors.ts
+++ b/site/src/utils/colors.ts
@@ -1,3 +1,5 @@
+import { hex } from "color-convert";
+
/**
* Does not support shorthand hex strings (e.g., #fff), just to maximize
* compatibility with server, which also doesn't support shorthand
@@ -83,3 +85,13 @@ export function hslToHex(hsl: string): string {
};
return `#${f(0)}${f(8)}${f(4)}`;
}
+
+export const readableForegroundColor = (backgroundColor: string): string => {
+ const rgb = hex.rgb(backgroundColor);
+
+ // Logic taken from here:
+ // https://github.com/casesandberg/react-color/blob/bc9a0e1dc5d11b06c511a8e02a95bd85c7129f4b/src/helpers/color.js#L56
+ // to be consistent with the color-picker label.
+ const yiq = (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000;
+ return yiq >= 128 ? "#000" : "#fff";
+};
diff --git a/site/tsconfig.json b/site/tsconfig.json
index 836d01dd3536f..b04675aee3161 100644
--- a/site/tsconfig.json
+++ b/site/tsconfig.json
@@ -1,22 +1,22 @@
{
"compilerOptions": {
- "downlevelIteration": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"incremental": true,
"isolatedModules": true,
"jsx": "react-jsx",
+ "jsxImportSource": "@emotion/react",
"lib": ["dom", "dom.iterable", "esnext"],
- "module": "commonjs",
+ "module": "esnext",
"moduleResolution": "node",
- "outDir": "./dist/",
+ "outDir": "build/",
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"target": "es2020",
- "baseUrl": "./src"
+ "baseUrl": "src/"
},
"include": ["**/*.ts", "**/*.tsx"],
- "exclude": ["node_modules", "_jest"],
- "types": ["node", "jest", "@testing-library/jest-dom"]
+ "exclude": ["node_modules/", "_jest"],
+ "types": ["@emotion/react", "@testing-library/jest-dom", "jest", "node"]
}