svgl/src/data/index.ts

27 lines
654 B
TypeScript
Raw Normal View History

2023-12-14 12:42:05 +00:00
import type { iSVG } from '@/types/svg';
import { svgs } from './svgs';
2023-12-16 18:10:13 +00:00
import { getBaseUrl } from '@/utils/getBaseUrl';
2023-12-14 12:42:05 +00:00
export const svgsData = svgs.map((svg: iSVG, index: number) => {
return { id: index, ...svg };
});
export const fullRouteSvgsData: iSVG[] = svgsData.map((svg) => {
2023-12-16 18:10:13 +00:00
const url = getBaseUrl();
if (typeof svg.route === 'object' && svg.route !== null) {
return {
...svg,
route: {
light: `${url}${svg.route.light}`,
dark: `${url}${svg.route.dark}`
}
};
} else if (typeof svg.route === 'string') {
return {
...svg,
route: `${url}${svg.route}`
};
}
return svg;
});