Skip to content

Commit

Permalink
Clean up the last useTheme() (#341)
Browse files Browse the repository at this point in the history
  • Loading branch information
JosephMarinier authored Jan 5, 2023
1 parent 64de31a commit 3d5c9fb
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions webapp/src/components/TopWords/TopWords.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box, Link, Typography, useTheme } from "@mui/material";
import { Box, Link, Typography } from "@mui/material";
import useResizeObserver from "hooks/useResizeObserver";
import React from "react";
import { Link as RouterLink } from "react-router-dom";
Expand Down Expand Up @@ -37,8 +37,6 @@ const TopWords: React.FC<Props> = ({
wordCounts,
palette = "success",
}) => {
const theme = useTheme();

// It is impossible to know how large the word cloud will end up being so we have to scale it down to fit the parent if it is too big
const [contentRef, contentWidth, contentHeight] = useResizeObserver();
const [wrapperRef, wrapperWidth, wrapperHeight] = useResizeObserver();
Expand Down Expand Up @@ -95,9 +93,7 @@ const TopWords: React.FC<Props> = ({
...pipeline,
...postprocessing,
})}`}
// Despite color's type allowing for `(theme) => `,
// it results in an uncaught error that crashes the app.
color={theme.palette[palette].dark}
color={`${palette}.dark`}
display="block"
fontSize={`${Math.max(
maxFontSizeInEm * count * normalizingScaleFactor,
Expand Down

0 comments on commit 3d5c9fb

Please sign in to comment.