2023-12-14 12:42:05 +00:00
|
|
|
import type { iSVG } from '@/types/svg';
|
|
|
|
import { svgs } from './svgs';
|
|
|
|
|
|
|
|
export const svgsData = svgs.map((svg: iSVG, index: number) => {
|
2023-12-14 16:15:20 +00:00
|
|
|
return { id: index, ...svg };
|
2024-09-24 08:41:12 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
export const getCategories = () => {
|
|
|
|
const categories = svgs
|
|
|
|
.flatMap((svg) => (Array.isArray(svg.category) ? svg.category : [svg.category]))
|
|
|
|
.filter((category, index, array) => array.indexOf(category) === index);
|
|
|
|
return categories;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const getCategoriesForDirectory = () => {
|
|
|
|
const categories = svgs
|
|
|
|
.flatMap((svg) => (Array.isArray(svg.category) ? svg.category : [svg.category]))
|
|
|
|
.filter((category, index, array) => array.indexOf(category) === index)
|
|
|
|
.map((category) => ({
|
|
|
|
slug: category.toLowerCase()
|
|
|
|
}));
|
|
|
|
return categories;
|
|
|
|
};
|