🚀 release v3.0.0

This commit is contained in:
Amruth Pillai
2022-03-06 22:48:29 +01:00
parent 00505a9e5d
commit 9c1380f401
373 changed files with 12050 additions and 15783 deletions

View File

@ -0,0 +1,29 @@
import get from 'lodash/get';
import isEmpty from 'lodash/isEmpty';
import { useCallback, useEffect } from 'react';
import { useAppSelector } from '@/store/hooks';
const FontWrapper: React.FC = ({ children }) => {
const typography = useAppSelector((state) => get(state.resume, 'metadata.typography'));
const loadFonts = useCallback(async () => {
const WebFont = (await import('webfontloader')).default;
const families = Object.values<string[]>(typography.family).reduce(
(acc, family) => [...acc, `${family}:400,600,700`],
[]
);
WebFont.load({ google: { families } });
}, [typography]);
useEffect(() => {
if (typeof window !== 'undefined' && !isEmpty(typography)) {
loadFonts();
}
}, [typography, loadFonts]);
return <>{children}</>;
};
export default FontWrapper;