Skip to content
Snippets Groups Projects
Commit e8756d9d authored by Oisin Coveney's avatar Oisin Coveney
Browse files

revert scalar change for this branch

parent b1055258
No related branches found
No related tags found
No related merge requests found
......@@ -23,20 +23,49 @@ import {
ScalarTitleContent,
ScalarValueWrapper,
} from "./ScalarValue.styled";
import { findSize, getMaxFontSize } from "./utils";
export const ScalarWrapper = ({ children }) => (
<ScalarRoot>{children}</ScalarRoot>
);
const ScalarValue = ({ value }) => {
const ScalarValue = ({
value,
height,
width,
gridSize,
totalNumGridCols,
fontFamily,
}) => {
const {
other: { number: numberTheme },
} = useMantineTheme();
const fontSize = useMemo(
() => numberTheme?.value?.fontSize,
[numberTheme?.value?.fontSize],
);
const fontSize = useMemo(() => {
if (numberTheme?.value?.fontSize) {
return numberTheme.value?.fontSize;
}
return findSize({
text: value,
targetHeight: height,
targetWidth: width,
fontFamily: fontFamily ?? "Lato",
fontWeight: 700,
unit: "rem",
step: 0.2,
min: 1,
max: gridSize ? getMaxFontSize(gridSize.width, totalNumGridCols) : 4,
});
}, [
fontFamily,
gridSize,
height,
totalNumGridCols,
value,
width,
numberTheme?.value?.fontSize,
]);
return (
<ScalarValueWrapper
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment