mirror of
https://github.com/encounter/objdiff-web.git
synced 2026-07-10 12:18:37 -07:00
Fix useFontSize hook in decomp.me
This commit is contained in:
@@ -3,9 +3,7 @@ import styles from './util.module.css';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
export const getCssVariablePx = (name: string) => {
|
||||
const value = getComputedStyle(document.documentElement).getPropertyValue(
|
||||
name,
|
||||
);
|
||||
const value = getComputedStyle(document.body).getPropertyValue(name);
|
||||
if (!value.endsWith('px')) {
|
||||
throw new Error(`Expected ${name} to be in px, got ${value}`);
|
||||
}
|
||||
@@ -26,6 +24,10 @@ export const useFontSize = () => {
|
||||
attributes: true,
|
||||
attributeFilter: ['style'],
|
||||
});
|
||||
observer.observe(document.body, {
|
||||
attributes: true,
|
||||
attributeFilter: ['style'],
|
||||
});
|
||||
return () => {
|
||||
observer.disconnect();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user