diff options
Diffstat (limited to 'stories/react/utils/InsertSVGIcons.js')
-rw-r--r-- | stories/react/utils/InsertSVGIcons.js | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/stories/react/utils/InsertSVGIcons.js b/stories/react/utils/InsertSVGIcons.js deleted file mode 100644 index 5a5e390..0000000 --- a/stories/react/utils/InsertSVGIcons.js +++ /dev/null @@ -1,15 +0,0 @@ -import {renderToStaticMarkup} from 'react-dom/server'; -import beautifyHTML from './BeautifyHTML.js'; - -const insertSVGIcons = ({html, jsx, indentChar = ' '}) => { - let svgCode = renderToStaticMarkup(jsx).match(/(<svg\b[^<>]*>)[\s\S]*?(<\/svg>)/g); - let newHTML = html.replace(/\s*<!-- insert SVG -->/g, str => { - let html = '\n' + svgCode.shift(); - let indentRegExp = new RegExp(`[${indentChar}]*`); - let startingIndentCount = str.slice(2).match(indentRegExp)[0].length / indentChar.length; - return beautifyHTML({html, startingIndentCount, indentChar}); - }); - return newHTML; -}; - -export default insertSVGIcons; |