exportTemplate.mjs28 lines · main
1/* eslint-disable import/no-extraneous-dependencies */
2import { base64SVG } from '@supabase/build-icons'
3
4export default ({ componentName, iconName, children, getSvg, deprecated, svgAttributes = {} }) => {
5 const svgContents = getSvg()
6 const svgBase64 = base64SVG(svgContents)
7
8 const hasAttrs = Object.keys(svgAttributes).length > 0
9 const attrsArg = hasAttrs ? `, ${JSON.stringify(svgAttributes)}` : ''
10
11 return `
12import createBrivenIcon from '../createBrivenIcon';
13
14/**
15 * @component @name ${componentName}
16 * @description Briven SVG icon component, renders SVG Element with children.
17 *
18 * @preview ![img](data:image/svg+xml;base64,${svgBase64})
19 *
20 * @param {Object} props - Briven icons props and any valid SVG attribute
21 * @returns {JSX.Element} JSX Element
22 * ${deprecated ? '@deprecated' : ''}
23 */
24const ${componentName} = createBrivenIcon('${componentName}', ${JSON.stringify(children)}${attrsArg});
25
26export default ${componentName};
27`
28}