2024-02-01 22:38:21 +09:00
|
|
|
import { createLucideIcon } from 'lucide-react/src/lucide-react';
|
2025-12-12 09:25:39 +01:00
|
|
|
import { type LucideProps, type IconNode } from 'lucide-react/src/types';
|
2024-02-01 22:38:21 +09:00
|
|
|
import { IconEntity } from '../theme/types';
|
2023-04-09 16:49:11 +02:00
|
|
|
import { renderToStaticMarkup } from 'react-dom/server';
|
2024-02-01 22:38:21 +09:00
|
|
|
import { IconContent } from './generateZip';
|
2023-04-09 16:49:11 +02:00
|
|
|
|
|
|
|
|
const getFallbackZip = (icons: IconEntity[], params: LucideProps) => {
|
2024-02-01 22:38:21 +09:00
|
|
|
return icons.map<IconContent>((icon) => {
|
|
|
|
|
const Icon = createLucideIcon(icon.name, icon.iconNode as IconNode);
|
|
|
|
|
const src = renderToStaticMarkup(<Icon {...params} />);
|
|
|
|
|
return [icon.name, src];
|
|
|
|
|
});
|
|
|
|
|
};
|
2023-04-09 16:49:11 +02:00
|
|
|
|
2024-02-01 22:38:21 +09:00
|
|
|
export default getFallbackZip;
|