exportTemplate.mjs28 lines · main
| 1 | /* eslint-disable import/no-extraneous-dependencies */ |
| 2 | import { base64SVG } from '@supabase/build-icons' |
| 3 | |
| 4 | export 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 ` |
| 12 | import createBrivenIcon from '../createBrivenIcon'; |
| 13 | |
| 14 | /** |
| 15 | * @component @name ${componentName} |
| 16 | * @description Briven SVG icon component, renders SVG Element with children. |
| 17 | * |
| 18 | * @preview  |
| 19 | * |
| 20 | * @param {Object} props - Briven icons props and any valid SVG attribute |
| 21 | * @returns {JSX.Element} JSX Element |
| 22 | * ${deprecated ? '@deprecated' : ''} |
| 23 | */ |
| 24 | const ${componentName} = createBrivenIcon('${componentName}', ${JSON.stringify(children)}${attrsArg}); |
| 25 | |
| 26 | export default ${componentName}; |
| 27 | ` |
| 28 | } |