import classNames from 'classnames';
import type { FC } from 'react';
import { Suspense, useEffect } from 'react';
import { usePageStoreContext } from '../PageStore';
const components = require.context('@/svgComponents/', true, /\w+\/index\.tsx/, 'sync');
const files = components.keys().map((v) => {
const path = v.substring(2, v.length - 'index.tsx'.length - 1);
return {
path,
component: components(v)[path],
};
});
export const SvgList: FC = () => {
const { svgComponent, dispatchSvgComponent } = usePageStoreContext();
useEffect(() => {
if (files?.length) {
dispatchSvgComponent({ name: files[0].path, component: files[0].component });
}
}, [dispatchSvgComponent]);
return (
{name}